Next.js Discord

Discord Forum

Routing: Dynamic segment in the middle of a route

Answered
Common carp posted this in #help-forum
Open in Discord
Common carpOP
I'm trying to create such route /foo-{query}-baz and I can't find anything on the topic. I tried creating foo-[query]-baz.tsx but that does not work unfortunately. Is this possible with Next.js? I'm using Pages router. Thanks
Answered by joulev
that's not possible, you have to use [slug].tsx and parse query to the slug in the form of foo-[query]-baz and back
View full answer

2 Replies

Answer
Common carpOP
Thanks @joulev