We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 2770253 commit b946e17Copy full SHA for b946e17
src/app/(frontend)/[locale]/posts/[slug]/page.tsx
@@ -23,6 +23,26 @@ type Args = {
23
}>
24
}
25
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
46
export default async function Post({ params: paramsPromise }: Args) {
47
const { isEnabled: draft } = await draftMode()
48
const { slug = '' } = await paramsPromise
0 commit comments