diff --git a/src/pages/[...route].astro b/src/pages/[...route].astro index d7cb1ee..c7c8f29 100644 --- a/src/pages/[...route].astro +++ b/src/pages/[...route].astro @@ -3,10 +3,10 @@ export const prerender = false; import { + defaultLocale, + localeCodes, removeTrailingSlash, useTranslatedPaths, - localeCodes, - defaultLocale, } from "@i18n"; import { handleRedirect } from "../redirects"; @@ -22,7 +22,8 @@ const [_, langParam] = Astro.url.pathname.split("/"); // if there's no lang parameter, detect language and redirect if (!langParam || !localeCodes.includes(langParam)) { const headerLang = Astro.request.headers.get("Accept-Language"); - const path = removeTrailingSlash(Astro.url.pathname); + const pathnameWithParams = Astro.url.href.replace(Astro.url.origin, ""); + const path = removeTrailingSlash(pathnameWithParams); // if the lang is french, serve the content in french if (headerLang?.includes("fr")) {