Skip to content

Commit b4266ae

Browse files
authored
back fallback
1 parent 0a8c7b9 commit b4266ae

1 file changed

Lines changed: 23 additions & 0 deletions

File tree

src/pages/[lang]/[...slug].astro

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,29 @@ export async function getStaticPaths() {
9898
}
9999
});
100100
101+
// Fallback: Create paths for non-English languages using English pages content
102+
for (const lang of Object.keys(languages)) {
103+
if (lang === 'en') continue;
104+
105+
const englishContentPages = contentPages.filter((p) => p.id.startsWith('en/'));
106+
107+
englishContentPages.forEach((page) => {
108+
const [, ...slugParts] = page.id.split('/');
109+
const fullSlug = slugParts.join('/');
110+
111+
const langSpecificExists = paths.some(
112+
(p) => p.params.lang === lang && p.params.slug === fullSlug
113+
);
114+
115+
if (!langSpecificExists) {
116+
paths.push({
117+
params: { lang, slug: fullSlug },
118+
props: { page },
119+
});
120+
}
121+
});
122+
}
123+
101124
return paths;
102125
}
103126

0 commit comments

Comments
 (0)