Search code examples
sveltesveltekit

Is it possible in sveltekit to create a folder based route with two dynamic slugs in a row?


I'm working on doing a 1:1 port of an existing svelte app that I created back around 2019 to svelte kit.

I currently have a route defined like this where there are two slugs back to back

/l/:token/:secret

Is there a way to express this in the folder based routing provided by sveltekit?

  • Note that I understand it would be easy ( and sensible ) to change this to something else, but this is an existing and actively used application and making a breaking change to this url structure would adversely affect users, so I plan to keep it as it.

Thanks!


Solution

  • You can have as many nested parameters as you want, as long as the routes do not become ambiguous. So this should just be:

    src/routes/l/[token]/[secret]/+page.svelte