Static GitHub Issues

[646] Routes with one required and one optional parameter (id + slug)

prev: How to pass data to layout from index.vue?
next: Routes with one required and one optional parameter (id )

In my currenct project I was using a route with a dynamic pattern which constituted of two params (releases/:id-:slug) where the slug part was generated only for SEO purposes.

I am now trying to migrate to Nuxt (since any SEO optimization is useless, if the page is not rendered server-side), but I have no idea how to create a folder structure which generates that router pattern without duplicating the source code (one _id/index.vue file for the required :id param and a _id/_slug.vue file for the optional slug parameter which both would have the same ). I tried to programmatically extend the routes which works for nuxt-links but since the standard route is generated anyway, when I refresh the page, the dynamic part is assumed to be the id part

Is it possible to migrate my pattern or should I extend my database to retrieve data directly through the slug?

<!--cmty--><!--cmty_prevent_hook--><div align="right"><sub><em>This question is available on <a href="https://nuxtjs.cmty.io">Nuxt.js</a> community (<a href="https://nuxtjs.cmty.io/nuxt/nuxt.js/issues/c557">#c557</a>)</em></sub></div>