question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Matched error when navigate using dynamic pages at same folder level

See original GitHub issue

Version

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:

Screenshot 2020-10-12 at 13 29 04

That is my current pages:

Screenshot 2020-10-12 at 13 31 03

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:closed
  • Created 3 years ago
  • Comments:8

github_iconTop GitHub Comments

2reactions
rchlcommented, Oct 12, 2020

I’d ask you to make a repro project (either a repo or on codesanbox).

1reaction
rchlcommented, Oct 19, 2020

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Matched error when navigate using dynamic pages at same ...
I have two dynamic routes nested in the blog route. One of them shows the posts detail _slug.vue and the other shows a...
Read more >
What is the correct folder structure for dynamic nested routes ...
js docs and think I understand the [slug].js dynamic routing process, but I struggling to understand nested dynamic routes in terms of folder...
Read more >
Routing in Next.js – How to Set Up Dynamic Routing with Pre ...
In this tutorial, you'll learn how to set up dynamic routing in Next.js. You'll also learn about pre-rendering and why it's important.
Read more >
Client-Side Routing In Next.js - Smashing Magazine
Next.js has a file-based routing system in which each page ... it is an error to have more than one dynamic route on...
Read more >
Implementing SSR in Next.js: Dynamic routing and prefetching
This means every page will use static site generation by default, one of the two rendering options that make up the hybrid architecture...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found