Next.js Discord

Discord Forum

GenerateStaticParams page accepting every param

Answered
Alligator mississippiensis posted this in #help-forum
Open in Discord
Alligator mississippiensisOP
Hi guys!

next v14.0.4

I've got a page at app/post/[slug]/page.tsx and I want to leverage generateStaticParams to build the dynamic routes.

I've ultra simplified the code just so it's easier to read. From what I understand, since my generateStaticParams is returning only one slug, then I should only have one page, which would be /post/dev-post.

If I navigate to /post/other-slug it renders the page rather than throwing a 404 page not found.

What am I missing?
Answered by Alligator mississippiensis
nevermind... was missing the dynamicParams option.
View full answer

1 Reply

Alligator mississippiensisOP
nevermind... was missing the dynamicParams option.
Answer