diff --git a/src/partials/header-nav-bar.ejs b/src/partials/header-nav-bar.ejs index b4401e144..763582015 100644 --- a/src/partials/header-nav-bar.ejs +++ b/src/partials/header-nav-bar.ejs @@ -35,8 +35,12 @@ const pages = { function changeHrefLocaleIfNecessary(links) { const localeName = localStorage.getItem(window.localeKey); for (const link of links) { - // Insert locale name into the URL - const href = link.getAttribute("href"); + // Insert locale name into the URL and replace the domain if it's included in the URL + const href = link + .getAttribute("href") + .replace(window.location.origin, "") + .replace(`${window.location.protocol}//`, ""); + if (!href.includes(localeName) && !href.includes("docs")) { link.setAttribute("href", `/${localeName}${href}`); }