Next.js Discord

Discord Forum

Does next.js supports two dynamic router directories?

Answered
Chipping Sparrow posted this in #help-forum
Open in Discord
Chipping SparrowOP
/app
  /how-to
    /[slug]
      page.tsx
    /page-[pageNumber]
      page.tsx


I have a content under slug directory, but I want to implement pagination as /how-to/page-1, /how-to/page-2 and so on. Can I use next. js like that? Or do I need to add business logiс in [slug]/page.tsx to hande this case?
Answered by Clown
No you cannot do partial matching like that and you cant have two dynamic routes on the same level.
View full answer

3 Replies

Answer
You can try and parse the slug and do conditional rendering however and use notFound() on everything else
Chipping SparrowOP
thank u very much