From ad5b336b594e2cca61bbb82d00fed74ca735c127 Mon Sep 17 00:00:00 2001 From: ramistodev <168463169+ramistodev@users.noreply.github.com> Date: Wed, 20 May 2026 21:05:24 +0200 Subject: [PATCH] fix(i18n): redirect 404 home link to the canonical locale path --- src/pages/404.astro | 44 ++++++++++++++++++++++++++++++++------------ 1 file changed, 32 insertions(+), 12 deletions(-) diff --git a/src/pages/404.astro b/src/pages/404.astro index da89871..f78ea13 100644 --- a/src/pages/404.astro +++ b/src/pages/404.astro @@ -1,18 +1,31 @@ --- -import Layout from "@layouts/Layout.astro" -import { translations, defaultLocale, type Locale, locales } from "@i18n/translations" +import Layout from '@layouts/Layout.astro' +import { translations, defaultLocale, type Locale, locales } from '@i18n/translations' const pathName = Astro.url.pathname -const locale = pathName.split("/")[1] as Locale +const locale = pathName.split('/')[1] as Locale const t = locales.includes(locale) ? translations[locale] : translations[defaultLocale] +const pathnameToRedirect = locales.includes(locale) && locale !== defaultLocale ? `/${locale}` : `/` ---
- -
-
+
@@ -25,14 +38,21 @@ const t = locales.includes(locale) ? translations[locale] : translations[default
- -
-
\ No newline at end of file +