Skip to content

fix(sitemap): derive locales from i18n config, add x-default and per-locale URLs - #754

Draft
dgaponov wants to merge 1 commit into
mainfrom
seo/sitemap-locales
Draft

fix(sitemap): derive locales from i18n config, add x-default and per-locale URLs#754
dgaponov wants to merge 1 commit into
mainfrom
seo/sitemap-locales

Conversation

@dgaponov

@dgaponov dgaponov commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

В sitemap был свой захардкоженный список локалей, разошедшийся с next-i18next.config.js: pt и ja не попадали в выдачу вообще, не было x-default, а в <loc> всегда шёл английский URL — восемь локализованных деревьев не отправлялись как самостоятельные страницы.

Теперь список берётся из i18n-конфига, генерируется по одному <url> на пару (path × locale) со взаимными альтернатами и x-default.

pt/ja перед включением проверены: полные словари (19 файлов, объём как у de/ru), страницы на реальных португальском и японском.

160 → 1440 URL (1.6 МБ), с запасом под лимитами Google. Выборка из 111 URL по всем локалям — все 200.

🤖 Generated with Claude Code

…locale URLs

The sitemap kept its own hardcoded locale list that had drifted from
next-i18next.config.js. Three problems followed:

- `pt` and `ja` were never submitted, although both are fully translated
  and already advertised in every page's <head> hreflang set.
- No x-default alternate was emitted.
- Only the English URL was ever used as <loc>, so the eight localized
  trees were never submitted as first-class URLs, only as alternate
  annotations hanging off the English entry.

Derive the list from the i18n config so it cannot drift again, emit one
<url> per (path x locale) with a self-referencing reciprocal alternate set,
and add x-default pointing at the English version.

pt and ja were verified to be genuine, complete locales before including
them: both ship all 19 dictionary files at sizes comparable to de and ru,
and their pages render real Portuguese and Japanese. The English meta
description they serve is a site-wide issue affecting ru and de equally,
not evidence that these routes are unintended.

Sitemap goes from 160 to 1440 URLs (1.6 MB), well under Google's 50k/50 MB
limits. Verified in dev and a production build: 10 distinct hreflang values,
x-default on every entry, 160 <loc> per locale, and a 111-URL spread sample
across locales all returning 200. Build, lint and typecheck pass. E2E not
run - Playwright browsers are not installed locally.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant