Skip to content

Commit b946e17

Browse files
committed
update
1 parent 2770253 commit b946e17

File tree

1 file changed

+20
-0
lines changed
  • src/app/(frontend)/[locale]/posts/[slug]

1 file changed

+20
-0
lines changed

src/app/(frontend)/[locale]/posts/[slug]/page.tsx

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,26 @@ type Args = {
2323
}>
2424
}
2525

26+
export async function generateStaticParams() {
27+
const payload = await getPayload({ config: configPromise })
28+
const posts = await payload.find({
29+
collection: 'posts',
30+
draft: false,
31+
limit: 1000,
32+
overrideAccess: false,
33+
pagination: false,
34+
select: {
35+
slug: true,
36+
},
37+
})
38+
39+
const params = posts.docs.map(({ slug }) => {
40+
return { slug }
41+
})
42+
43+
return params
44+
}
45+
2646
export default async function Post({ params: paramsPromise }: Args) {
2747
const { isEnabled: draft } = await draftMode()
2848
const { slug = '' } = await paramsPromise

0 commit comments

Comments
 (0)