Replies: 1 comment
-
Hi! Next needs slug names to be different for a single dynamic path. Otherwise, the route segment won't be able to access its parents' slug names, as the slug with the same name would rewrite the previous one. So in your case, it can be
export default async function ReviewPage({
params,
}) {
const { post_slug, review_slug } = await params;
...
} If Next was to allow the same slug name, you'd have this situation:
export default async function ReviewPage({
params,
}) {
const { slug } = await params; // can't access post slug
...
} |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Summary
I have this structure:
post/[slug]
When I add a sub folder like
post/[slug]/reviews/[slug]
it returns 404 error, when I change it topost/[slug]/reviews/[slugb]
it works. Any idea why? It is a weird behaviour.Additional information
I found this: https://nextjs.org/docs/app/building-your-application/routing/dynamic-routes#optional-catch-all-segments
But it does not help in my case, I want to use the folder structure like this:
post/[slug]/reviews/[slug]
Example
No response
Beta Was this translation helpful? Give feedback.
All reactions