-
-
Notifications
You must be signed in to change notification settings - Fork 262
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added named routes module #482
Conversation
Open in CodeSandbox Web Editor | VS Code | VS Code Insiders |
Hi @tiborpino I am not sure to fully understand the purpose of the module, could you give me an example of using it vs creating in |
Hi @atinux The main purpose is you can set custom key for every page inside pages directory and also custom url path for every route. Here is the example I set named route key
Now I can use it as follows
And the generated HTML link will look like
And now if I want to change file name to something like |
Indeed, I thought It would be nice to be able to leverage |
It should be possible overriding name with pageMeta indeed. We already support similar |
Agreed 👍 |
I guess this will land in RC13 👀 |
No it won't. If you will define alias via page all your NuxtLink are fully dependent on the alias value. Change alias value and all links with that alias are broken. My module will separate link key from file declaration and url for that page. When you decide to change page file name or page url, your key remains the same and all links are valid. |
By using Nuxt RC 13 (coming): definePageMeta({
name: 'my-key'
}) Will specify the name of the route, you can rename the page but the name won't change. |
The code above will generate page on the url /my-key When you want to change the url, you have to change the value of the name key in definePageMeta function. Then all keys are invalid. |
Added named routes module