I'm trying to setup routes to display a given user post (named snap
in my case).
The route to show a specific post is /{user}/snap/{idSnap}
.
Now, to make it more friendly I want the user to be able to link to that post by adding a totally optional (and not used at all) slug after that url.
So the user should be able to see that same post by going to /{user}/snap/{idSnap}/{slugSnap}
.
I tried ~too~ many directory and filename configurations, but unfortunately cannot find a way to make it work so that:
/usertest/snap/12
,/usertest/snap
, and/usertest/snap/12/slugfoo
url works.This is the last directory configuration I tried so far:
Moreover, in all the configurations I tried, since the documentation states that in order to make a parameter mandatory you need to create an index.vue
file in the param directory, is it possible to have the /usertest/snap/12
and /usertest/snap/12/slugfoo
urls points to the same component?
Thanks!
<!--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/c1682">#c1682</a>)</em></sub></div>