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

@@ -11,8 +11,6 @@ const gameDefinitions = await fetchGameDefinitions();
const PUBLIC_ASSET_BRANCH = assertSecret(import.meta.env.PUBLIC_ASSET_BRANCH); const PUBLIC_ASSET_BRANCH = assertSecret(import.meta.env.PUBLIC_ASSET_BRANCH);
const locale = Astro.params.locale ?? DEFAULT_LOCALE; const locale = Astro.params.locale ?? DEFAULT_LOCALE;
const strings = getStrings(locale); const strings = getStrings(locale);
console.log(`DEBUG: ${gameDefinitions.version}`);
--- ---
<style> <style>
@@ -39,7 +39,11 @@ const locale = Astro.params.locale ?? DEFAULT_LOCALE;
window.location.pathname.startsWith(`/${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 = isI18nPath
? window.location.pathname.replace( ? window.location.pathname.replace(
`/${currentPathLocale}`, `/${currentPathLocale}`,