Nuxt.js: How to change the slug of a specific Page file

Created on 9 Sep 2020  路  3Comments  路  Source: nuxt/nuxt.js

As of now, the slug is based on the filename inside the page. Of course, we can customize it dynamically:
https://nuxtjs.org/guide/routing/

Is there such a thing like these:

page/custom.vue
export default { slug: 'my-custom-slug', //this is what I am thinking }

page/another.vue
export default { slug: 'another-changed-slug', //this way }

question

Most helpful comment

According to docs:

There are multiple ways to extend the routing with Nuxt:
- router-extras-module to customize the route parameters in the page component
- @nuxtjs/router to overwrite the Nuxt router and write your own router.js file
- Use the router.extendRoutes property in your nuxt.config.js

I do suggest to use router-extras-module. Take a look to an example

All 3 comments

According to docs:

There are multiple ways to extend the routing with Nuxt:
- router-extras-module to customize the route parameters in the page component
- @nuxtjs/router to overwrite the Nuxt router and write your own router.js file
- Use the router.extendRoutes property in your nuxt.config.js

I do suggest to use router-extras-module. Take a look to an example

Thank you. :D

馃憤 I close this issue, if you have any question feel free to ask

Was this page helpful?
0 / 5 - 0 ratings

Related issues

mikekidder picture mikekidder  路  3Comments

o-alexandrov picture o-alexandrov  路  3Comments

pehbehbeh picture pehbehbeh  路  3Comments

maicong picture maicong  路  3Comments

gary149 picture gary149  路  3Comments