Matched error when navigate using dynamic pages at same folder level
See original GitHub issueVersion
nuxt-i18n: 6.15.1 nuxt: 2.14.0
Nuxt configuration
mode:
- universal
- [] spa
Nuxt-i18n configuration
i18n: {
strategy: 'no_prefix',
locales: [
{
code: 'es',
iso: 'es-ES',
file: 'es-ES.js',
name: 'Español',
domain: 'https://mydomain.com',
},
// {
// code: 'en',
// iso: 'en-US',
// file: 'en-US.js',
// name: 'English',
// domain: 'https://en.mydomain.com',
// },
],
vueI18n: {
fallbackLocale: 'es',
},
defaultLocale: 'es',
noPrefixDefaultLocale: true,
parsePages: false,
detectBrowserLanguage: false,
seo: true,
lazy: true,
langDir: 'i18n/',
},
Reproduction Link
https://codesandbox.io/s/suspicious-night-zbhxz?file=/pages/blog/index.vue
Steps to reproduce
I have two dynamic routes nested in the blog route. One of them shows the posts detail _slug.vue
and the other shows a list of posts related to a category _category.vue
. When I access to the detail of a post from the path _category.vue
. instead of using the path blog-name
keep using` blog-category '.
Both routes use the same PostCard component, that redirects to the _slug.vue
page:
<NuxtLink
:to="
localePath({
name: 'blog-slug',
params: { slug: post.slug },
})
"
>
But it doesn’t redirect well. It does this using the path _category.vue
:
That is my current pages:
What is Expected?
When navigating from http://localhost:8000/blog/page/1
to detail post, should navigate to http://localhost:8000/blog/post-slug using
_slug.vueinstead of
_category.vue`
What is actually happening?
Navigating always using _category.vue
Note: Using NuxtLink whiteout localePath
, works fine!
Issue Analytics
- State:
- Created 3 years ago
- Comments:8
Top GitHub Comments
I’d ask you to make a repro project (either a repo or on codesanbox).
It still looks to me like server side rendering won’t be able to differentiate between category and year/month/slug routes but at least it’s not a nuxt-i18n issue.