From 6bfb06a83ebd5e35929de59d6591f5e9af62ba47 Mon Sep 17 00:00:00 2001 From: Jiminy Panoz Date: Thu, 17 Sep 2026 08:37:07 +0200 Subject: [PATCH 1/4] Add self-referential canonical to Layout --- src/layouts/Layout.astro | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/layouts/Layout.astro b/src/layouts/Layout.astro index 029107f..3d8b222 100644 --- a/src/layouts/Layout.astro +++ b/src/layouts/Layout.astro @@ -1,12 +1,20 @@ --- import { Font } from "astro:assets"; +import { getRelativeLocaleUrl } from "astro:i18n"; import "../styles/global.css"; import Header from "../components/Header.astro"; import HeroBlob from "../components/blobs/HeroBlob.astro"; import { t } from "../i18n/utils.js"; +import { defaultLocale, locales, bcp47Locale } from "../i18n/locales.js"; const { title, description, blob = false, illustration } = Astro.props; -const lang = Astro.currentLocale; +const lang = Astro.currentLocale ?? defaultLocale; + +// Same locale-stripping approach as LanguagePicker.astro, so canonical/hreflang +// stay consistent with the language switcher's own URL generation. +const withoutBase = Astro.url.pathname.slice(import.meta.env.BASE_URL.length); +const currentPath = "/" + withoutBase.split("/").filter(Boolean).slice(1).join("/"); +const localizedUrl = (locale: string) => new URL(getRelativeLocaleUrl(locale, currentPath), Astro.site); --- @@ -16,6 +24,11 @@ const lang = Astro.currentLocale; { title ?? t(lang, "site.title") } + + { locales.map((locale) => ( + + )) } + From a707527a84938070d3f37058759f92708b8d95f5 Mon Sep 17 00:00:00 2001 From: Jiminy Panoz Date: Thu, 17 Sep 2026 08:48:11 +0200 Subject: [PATCH 2/4] Add head with canonical to redirect --- src/components/LocaleRedirect.astro | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/src/components/LocaleRedirect.astro b/src/components/LocaleRedirect.astro index 75327c7..44fad88 100644 --- a/src/components/LocaleRedirect.astro +++ b/src/components/LocaleRedirect.astro @@ -1,13 +1,25 @@ --- import { locales, defaultLocale } from "../i18n/locales.js"; -const { path } = Astro.props; +const { path, noindex = false } = Astro.props; const base = import.meta.env.BASE_URL; const fallback = `${ base }${ defaultLocale }/${ path }`; +const canonical = new URL(fallback, Astro.site).href; --- - - + + + + + Redirecting to: { canonical } + + { noindex && } + + + + + + From 5a39d981e43bf48b1e9ce8773e04dd4aac63fd68 Mon Sep 17 00:00:00 2001 From: Jiminy Panoz Date: Thu, 17 Sep 2026 08:53:42 +0200 Subject: [PATCH 3/4] No-index add pages --- src/layouts/Layout.astro | 3 ++- src/pages/[lang]/add/catalog.astro | 2 +- src/pages/[lang]/add/publication.astro | 2 +- src/pages/add/catalog.astro | 2 +- src/pages/add/publication.astro | 2 +- 5 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/layouts/Layout.astro b/src/layouts/Layout.astro index 3d8b222..2e6de4c 100644 --- a/src/layouts/Layout.astro +++ b/src/layouts/Layout.astro @@ -7,7 +7,7 @@ import HeroBlob from "../components/blobs/HeroBlob.astro"; import { t } from "../i18n/utils.js"; import { defaultLocale, locales, bcp47Locale } from "../i18n/locales.js"; -const { title, description, blob = false, illustration } = Astro.props; +const { title, description, blob = false, illustration, noindex = false } = Astro.props; const lang = Astro.currentLocale ?? defaultLocale; // Same locale-stripping approach as LanguagePicker.astro, so canonical/hreflang @@ -24,6 +24,7 @@ const localizedUrl = (locale: string) => new URL(getRelativeLocaleUrl(locale, cu { title ?? t(lang, "site.title") } + { noindex && } { locales.map((locale) => ( diff --git a/src/pages/[lang]/add/catalog.astro b/src/pages/[lang]/add/catalog.astro index bf0e675..204307b 100644 --- a/src/pages/[lang]/add/catalog.astro +++ b/src/pages/[lang]/add/catalog.astro @@ -24,7 +24,7 @@ const retryLinkSlots: Record = { }; --- - +

{ t(lang, "add.catalog.title") }

diff --git a/src/pages/[lang]/add/publication.astro b/src/pages/[lang]/add/publication.astro index 2688f35..a7a183d 100644 --- a/src/pages/[lang]/add/publication.astro +++ b/src/pages/[lang]/add/publication.astro @@ -24,7 +24,7 @@ const retryLinkSlots: Record = { }; --- - +

{ t(lang, "add.publication.title") }

diff --git a/src/pages/add/catalog.astro b/src/pages/add/catalog.astro index c52a3bc..d8a339a 100644 --- a/src/pages/add/catalog.astro +++ b/src/pages/add/catalog.astro @@ -1,4 +1,4 @@ --- import LocaleRedirect from "../../components/LocaleRedirect.astro"; --- - + diff --git a/src/pages/add/publication.astro b/src/pages/add/publication.astro index da2cce8..feff6a1 100644 --- a/src/pages/add/publication.astro +++ b/src/pages/add/publication.astro @@ -1,4 +1,4 @@ --- import LocaleRedirect from "../../components/LocaleRedirect.astro"; --- - + From e9b936c0e62fa9c1c1aec961dbfb2fe885f478be Mon Sep 17 00:00:00 2001 From: Jiminy Panoz Date: Thu, 17 Sep 2026 08:56:37 +0200 Subject: [PATCH 4/4] Add home and guides to allowlist --- src/sitemap-allowlist.json | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/sitemap-allowlist.json b/src/sitemap-allowlist.json index 353b938..4c8aa72 100644 --- a/src/sitemap-allowlist.json +++ b/src/sitemap-allowlist.json @@ -1,5 +1,7 @@ [ + { "path": "/", "locales": "*" }, { "path": "/download/", "locales": "*" }, - { "path": "/release-notes/desktop/\\d+-\\d+-\\d+/", "locales": ["en"] }, + { "path": "/guides/.*", "locales": ["en"] }, + { "path": "/release-notes/desktop/\\d+-\\d+-\\d+/", "locales": "*" }, { "path": "/release-notes/ios/\\d+-\\d+-\\d+/", "locales": "*" } ]