From 312abeab4ae61a24f24bed58f439de10b6916691 Mon Sep 17 00:00:00 2001 From: Hiroshi SHIBATA Date: Tue, 15 Sep 2026 13:22:10 +0900 Subject: [PATCH 1/3] Generate the 404 language list from site data 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 --- 404.md | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/404.md b/404.md index eac009baab..0796f992d0 100644 --- a/404.md +++ b/404.md @@ -8,15 +8,12 @@ sitemap: false From 50c142e92fdad6f9af8e00cf6b1a5ec435ec0b12 Mon Sep 17 00:00:00 2001 From: Hiroshi SHIBATA Date: Tue, 15 Sep 2026 13:22:27 +0900 Subject: [PATCH 2/3] Stop the 404 redirect loop for languages without a 404 page 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 --- 404.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/404.md b/404.md index 0796f992d0..08ca341d4c 100644 --- a/404.md +++ b/404.md @@ -13,6 +13,8 @@ sitemap: false const match = path.match(/^\/([^\/]+)(\/.*)$/); if (!match || match[1] === 'en' || !languages.includes(match[1])) return; const notFound = '/' + match[1] + '/404.html'; + // A language without its own 404 page is served this page again there + if (path === notFound) return; window.location.href = notFound; })(); From 64ba76acad0301e381bdfc9ef908a962020de963 Mon Sep 17 00:00:00 2001 From: Hiroshi SHIBATA Date: Tue, 15 Sep 2026 13:22:39 +0900 Subject: [PATCH 3/3] Redirect missing translations to the English page 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 --- 404.md | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/404.md b/404.md index 08ca341d4c..b673b732a9 100644 --- a/404.md +++ b/404.md @@ -15,7 +15,13 @@ sitemap: false const notFound = '/' + match[1] + '/404.html'; // A language without its own 404 page is served this page again there if (path === notFound) return; - window.location.href = notFound; + // Fall back to the English page when a translation does not exist + const english = '/en' + match[2]; + fetch(english, { method: 'HEAD' }) + .then(function(res) { return res.ok; }, function() { return false; }) + .then(function(found) { + window.location.replace(found ? english + window.location.search + window.location.hash : notFound); + }); })();