Skip to content
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

How to have multiple aliases for the same page? #30

Closed
adi-zz opened this issue Feb 22, 2018 · 4 comments
Closed

How to have multiple aliases for the same page? #30

adi-zz opened this issue Feb 22, 2018 · 4 comments

Comments

@adi-zz
Copy link

adi-zz commented Feb 22, 2018

I want URLs having 2 different patterns to point to the same page:

  • for cars with odd id: /en/car/1, /voiture/1
  • for cars with even id: /en/latest/2, /nouveau/2

(both should render the same /pages/cars/show.vue component)

Could this be implement with the current version? And I wonder how both routes: { ... } object and localePath( ... ) call should look.

Thanks for this module.

This feature request is available on Nuxt.js community (#c20)
@paulgv
Copy link
Collaborator

paulgv commented Feb 25, 2018

Hi @adi-zz
This is currently not possible with current version but it would certainly be an interesting feature.
In the meantime you could probably "hack" your way to a solution by using other pages that export the page's module you'd like to translate, kinda like it's done in Nuxt's i18n official example: https://nuxtjs.org/examples/i18n

@1hakr
Copy link

1hakr commented Jul 21, 2018

How can you use this when you have dynamic routes, i mean how do you pass params to a vue page

@1hakr
Copy link

1hakr commented Jul 28, 2018

I was able to achieve this with declaring another path in extendRoutes instead of using alias by extending router module

extendRoutes (routes) {
  routes.push({name: 'old-path', path: '/old-path', component: '~pages/index.vue'})
}

I hope this i will be useful to others.

@stale
Copy link

stale bot commented Jun 13, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix label Jun 13, 2019
@stale stale bot closed this as completed Jun 20, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants