I use the newest version of nextjs with app router, and I’m a little bit stuck with route organization.
I need routing like that, but can`t figure out how to do it
catalog/[category]/[id] ===> id.jsx
catalog/[category] ===> catalog.jsx
catalog ===> catalog.jsx
2
Answers
This can be accomplished using a combination of file-based routing as you mentioned. You want catalog/[category]/[id] and catalog/[category] to route to different pages, but catalog should route to the same page as catalog/[category].
You can place a page.jsx file inside of the category folder and style that but when someone reaches your pages.jsx file via routing they will see the category page.jsx as well.
Have your folder structure like this: