chore: add generateStaticParams to blog post page

This commit is contained in:
javayhu 2025-05-31 09:21:40 +08:00
parent 6a4f0575c4
commit 80763b4efb

View File

@ -69,16 +69,15 @@ async function getRelatedPosts(post: Post) {
return relatedPosts;
}
// remove generateStaticParams for now, because blog post page is not static
// export function generateStaticParams() {
// return LOCALES.map((locale) => {
// const posts = allPosts.filter((post) => post.locale === locale);
// return posts.map((post) => ({
// locale,
// slug: post.slugAsParams,
// }));
// });
// }
export function generateStaticParams() {
return LOCALES.flatMap((locale) => {
const posts = allPosts.filter((post) => post.locale === locale);
return posts.map((post) => ({
locale,
slug: [post.slugAsParams],
}));
});
}
export async function generateMetadata({
params,