Skip to content

Redirect missing translations to the English page - #4008

Merged
hsbt merged 3 commits into
masterfrom
claude/awesome-murdock-7707b5
Sep 15, 2026
Merged

hsbt merged 3 commits into
masterfrom
claude/awesome-murdock-7707b5

Conversation

@hsbt

@hsbt hsbt commented Sep 15, 2026

Copy link
Copy Markdown
Member

When a page or news post has no translation, such as /de/news/2026/09/15/ruby-4-0-7-released/, visitors get a 404 although the English page exists. The 404 script also had two bugs. Its hand-written language list still had ua, so missing /uk/ pages stayed on the English 404. And /vi/404.html does not exist, so missing /vi/ pages reloaded it endlessly.

GitHub Pages serves the root 404.html for every missing URL, so I handle it there. The script sends a HEAD request for the same path under /en/ and moves there with location.replace if it exists, or to /<lang>/404.html otherwise. It does nothing when it is already on /<lang>/404.html, which rules out the loop. The language list now comes from site.data.languages.

Unlike #3757, no English pages are copied into language directories.

Generated with Claude Code

hsbt and others added 3 commits September 15, 2026 13:22
The hand-written list still had the old `ua` code, so a missing page
under /uk/ stayed on the English 404 page instead of /uk/404.html.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
vi has no 404 page, so /vi/404.html is answered with the root 404 page,
whose script redirected to /vi/404.html again without end.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
A page or news post that has not been translated returned the
language's 404 page, although the English original exists. GitHub
Pages serves the root 404 page for every missing URL, so check the
English URL from there instead of copying English pages into each
language.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@hsbt
hsbt requested a review from a team as a code owner September 15, 2026 04:29
@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying www-ruby-lang-org with  Cloudflare Pages  Cloudflare Pages

Latest commit: 64ba76a
Status: ✅  Deploy successful!
Preview URL: https://1d662aa4.www-ruby-lang-org.pages.dev
Branch Preview URL: https://claude-awesome-murdock-7707b.www-ruby-lang-org.pages.dev

View logs

@hsbt
hsbt merged commit b1b7365 into master Sep 15, 2026
3 checks passed
@hsbt
hsbt deleted the claude/awesome-murdock-7707b5 branch September 15, 2026 04:35
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