mirror of
https://github.com/Ocelot-Social-Community/ocelot.social.git
synced 2026-04-06 01:25:18 +00:00
redirect to english if page is missing
This commit is contained in:
parent
ad433e9888
commit
a4356ada40
@ -250,6 +250,26 @@ export default hopeTheme({
|
|||||||
'/fr/': ['fr-FR', 'fr'],
|
'/fr/': ['fr-FR', 'fr'],
|
||||||
},
|
},
|
||||||
localeFallback: false,
|
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: {
|
slimsearch: {
|
||||||
indexContent: true,
|
indexContent: true,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user