From a4356ada409a426cedee481ed88595827cbf7059 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Wed, 4 Mar 2026 14:35:11 +0100 Subject: [PATCH] redirect to english if page is missing --- docs/.vuepress/config/theme.js | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/docs/.vuepress/config/theme.js b/docs/.vuepress/config/theme.js index 770d0fd..8eb254d 100644 --- a/docs/.vuepress/config/theme.js +++ b/docs/.vuepress/config/theme.js @@ -250,6 +250,26 @@ export default hopeTheme({ '/fr/': ['fr-FR', 'fr'], }, localeFallback: false, + + // Redirect to English for pages missing in other locales + config: (app) => { + const fallback = '/en/' + const locales = ['/de/', '/es/', '/fr/'] + const pagePaths = new Set(app.pages.map((p) => p.path)) + const enPages = app.pages.filter((p) => p.path.startsWith(fallback)).map((p) => p.path) + const redirects = {} + + for (const locale of locales) { + for (const enPath of enPages) { + const localePath = enPath.replace(fallback, locale) + if (!pagePaths.has(localePath)) { + redirects[localePath] = enPath + } + } + } + + return redirects + }, }, slimsearch: { indexContent: true,