#Multiple path params?

10 messages · Page 1 of 1 (latest)

ripe sinew
#

I'm having trouble with multiple path params. I have a wiki structure, e.g.

handbook.tsx
handbook.$slug.tsx
handbook.$slug.$slug.tsx

A route can be a page or a sub-page.

The first level of pages works fine, but subpages do not. When I console.log Route.params in the child page route file, I only get the first level slug, not the second. When I navigate to "handbook/my-page/my-subpage", I get a 404. When I navigate to "handbook/my-page", I get the correct page.

Any ideas on how I can implement this? Thanks

knotty thunder
#

please provide a minimal complete example by forking an existing example on stackblitz

gaunt fable
#

@ripe sinew If i remember correctly, you need to rename the file to handbook.$slug.index.tsx

ripe sinew
knotty thunder
#

you need to either define multiple path params (you only have a single one in your example)

#

or use the splat definition which is just $

ripe sinew
#

I tried the splat method that but then no route matches. Can you please explain in more detail how you would solve this? I'd rather not create identical route files for each level of the data tree.

knotty thunder
#

what do you mean by "no route matches" ?

ripe sinew