#Nested dynamic routes
16 messages · Page 1 of 1 (latest)
🔎 This post has been indexed in our web forum and will be seen by search engines so other users can find it outside Discord
🕵️ Your user profile is private by default and won't be visible to users outside Discord, if you want to be visible in the web forum you can add the "Public Profile" role in id:customize
✅ You can mark a message as the answer for your post with Right click -> Apps -> Mark Solution
(if you don't see the option, try refreshing Discord with Ctrl + R)
that would be something like
|_app
|____case-study
|_______[industry]
|_________page.tsx
|__________[slug]
|______________page.tsx
If you don't want to generateStaticParams in both page.tsx
You can either do it for both segements from the bottom up https://nextjs.org/docs/app/api-reference/functions/generate-static-params#generate-params-from-the-bottom-up
Or from the top down https://nextjs.org/docs/app/api-reference/functions/generate-static-params#generate-params-from-the-top-down
sorry for the intends it's a bit fucked i did it by hand like a maniac
interesting so I was mostly right then, I opted for currently doing:
|_app
|____case-study
|_______[...slug]
|_________page.tsx
so just replace it from a spread to normal route groups
i mean you can also catch all like you did it with the ...
Hmm you got me thinking why I would got with my approach.
Don't want to say anything wrong i gonna research this
yeah, that's where i'm at, I recall a colleague at one point saying the current solution for app router is route groups, but not sure if there's been a better way by now
in your example
/case-study/{slug} and /case-study/{industry}/{slug}
How do you know that left side {slug} is not a {industry} ?
Let's say case-study/banking
Banking being an industry logically speaking.
Assuming beacuse its just 1 segment?
So case-study/banking/bank-of-england should trigger the right side?
Does that mean that case-study/bank-of-england must exist too though? Are these two {slugs} connected? Is what i am trying to ask
they're not connected directly no, in your example case-study/bank-of-england is just the project/company, and then you'd look up all relevant studies based on banking or finance for example
so the idea would be /case-study/c/{banking} however, doesn't seem like you can do multiple dynamic routes without route groups
Hm yea i tried to come up with something but I can't. Pretty sure you are right. I would not even have thought of route groups for this as a solution.
I came here with the intention to help but today sir you helped my understanding
glad I was able to help as well 🙂 I don't particularly like the routing system app router provides, but I do like a few of the things it solves
Lets see if one of the veterans joins this thread and might have something we both didnt think of
I ended up finding a solution that works 🙂
interesting what does the t\ do