Repository navigation
docs: send readers to their language and list translated sitemaps - #16314
Merged
Merged
Conversation
A reader arriving on an English docs page from outside the site now lands on the same page in their language when a translation exists: the language they last picked in the header menu, or else their browser's first translated preference. Internal clicks, crawlers and readers whose browser prefers English are never redirected. robots.txt now lists every language's sitemap. The root sitemap only covers English, so the translated pages were missing from it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
devGregA
enabled auto-merge
October 13, 2026 00:43
devGregA
disabled auto-merge
October 13, 2026 04:16
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Language redirect. A reader who arrives on an English docs page from outside the site now lands on the same page in their language, if that page has a translation. The language comes from:
It never redirects:
Traditional Chinese browsers stay on English rather than going to Simplified. All Portuguese variants go to pt-br. The redirect uses
location.replaceand keeps the query string and anchor, so the back button never loops.Sitemaps. The root
/sitemap.xmlonly lists English pages. Each language has its own/<lang>/sitemap.xml, but nothing pointed to them.robots.txtnow lists all eight.Why
Two weeks of site analytics show that few readers find the translations. For example, 93 docs visitors had German browsers but only 8 opened a German page. Each page already has correct hreflang tags. The gaps were search engines never being shown the translated sitemaps and readers never being sent to their language.
Testing
hugo --minify --config config/production/hugo.toml) is clean.enbeats a German browser, and a savedesbeats a German browser. An internal referrer doesn't redirect, while an external referrer from Google does. Googlebot doesn't redirect, and query plus hash are kept.🤖 Generated with Claude Code