route groups with dynamic routes, is it possible
Unanswered
Ocicat posted this in #help-forum
OcicatOP
when I have the structure
Nextjs routes to the
However, if I were to do the following using https://nextjs.org/docs/app/building-your-application/routing/route-groups:
I instead always get routed to the
It does route me to
Is this a bug? Is there a way to fix this? Thanks!
my-folder
├── layout.tsx
├── page.tsx
├── [slug]
└── some-routeNextjs routes to the
some-route folder/route instead of the dynamic slug folder/route for the url /some-route. I am assuming Nextjs does this this is because of an exact match. However, if I were to do the following using https://nextjs.org/docs/app/building-your-application/routing/route-groups:
(my-folder)
├── layout.tsx
├── page.tsx
└── [slug]
(my-other-folder)
├── layout.tsx
├── page.tsx
└── some-routeI instead always get routed to the
[slug] for the url /some-route despite them still being at the same "level" but this time in different groups. It does route me to
some-route with the following configuration as it is almost identical to the first, but then I won't get the layout specified in the my-other-folder group:(my-folder)
├── layout.tsx
├── page.tsx
├── [slug]
└── some-route
(my-other-folder)
├── layout.tsx
└── page.tsxIs this a bug? Is there a way to fix this? Thanks!