Skip to content

Rename slug folder [slug] to [...slug] #452

Answered by mkalsi25
netlarico asked this question in Q&A
Discussion options

You must be logged in to vote

When I change the folder [slug] name from:

app/posts/[slug]/page.tsx http://localhost:3000/posts/change-me Works!.

to:

app/posts/[...slug]/page.tsx http://localhost:3000/posts/myfolder/test Doesn't Work!.

I've created mdx file in posts/myfolder/test.mdx

I got some errors: Error: A required parameter (slug) was not provided as an array received string in generateStaticParams for /posts/[...slug]

I'm testing from: https://github.com/contentlayerdev/next-contentlayer-example/

Should i edit contentlayer.config.ts or app/posts/[slug]/page.tsx ?

To use "catch all segment", you need to pass slug value in array format in generateStaticParams.

In your case, you need to edit your file app/posts/[…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@netlarico
Comment options

Answer selected by netlarico
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #450 on May 07, 2023 09:19.