feat: google crawler

This commit is contained in:
tresabhi committed 2025-03-03 17:49:45 -06:00
1 parent 2ef6d18f82
commit c964e3c8ec
2 files changed
+5 -3

No files matched your search

@@ -39,7 +39,11 @@ const locale = Astro.params.locale ?? DEFAULT_LOCALE;
window.location.pathname.startsWith(`/${locale}`),
);
if (!isAPI && bestLocale !== currentPathLocale) {
if (
!isAPI && // not an api, duh!
localStorage.getItem('preferred-locale') !== null && // no preference, so probably google's crawler
bestLocale !== currentPathLocale // we need to redirect
) {
window.location.pathname = isI18nPath
? window.location.pathname.replace(
`/${currentPathLocale}`,