#Matching `/info/` and /info/something/$slug` but not `/info/something`

6 messages · Page 1 of 1 (latest)

strong viper
#

Is it possible to create something like this with just one route?

latent swallow
#

No.

tulip burrow
#

I mean, you can make a match for this, but it would just be

/info/$slug

Personally, I would just make three routes

info/
  index.ts
  something.ts
  something.$.ts

If all of these share a layout, you can make a route.ts in the info folder to have a shared layout, and if something/$slug is not a child of something, then you need to make sure that the file is named something_.$.ts so that something is not a parent route

#

Actually sorry, I mis-read your question, you don't want /info/something

I think you can just do

info/
  index.ts
  something_.$.ts

underscore before the . signifies that it should act as one match. You will still require two routes though. It probably helps if you can indicate what you expect the behaviour to be? is /info/ completely unrelated to /info/something/$slug or does it act as a layout. you will require two routes either way (but the structure you use would change based on the requirements)

strong viper
#

Yes, I'd like to have something like this

/blog (shows all categories)
/blog/categories/$slug shows posts per category
/blog/$slug shows specific blog post

UI in both blog and blog/categories/how-to would be exactly the same we would just mark tab how-to as active

#

I know I can create 2 routes and extract whole content to a separate component however thought there is away