kozdro
kozdro

Reputation: 123

Problem with index.vue in parent folder with NuxtI18n

I've problem with index.vue file when it is placed in another folder in /pages in my Nuxt 3 app. When I try to go to /wydarzenia I get 404, only /events works. The same is with events/special.vue - events/special works fine, but /wydarzenia/specjalne doesn't work (404). The problem is only when there is another folder in /pages, e.g. about.vue works fine in every language.

My folder structure:

-| pages/
---| about.vue
---| events/
-----| index.vue
-----| special.vue
-----| [slug].vue

i18n configuration in nuxt.config.ts:

  i18n: {
    defaultLocale: 'pl',
    vueI18n: 'vue-i18n.options.ts',
    lazy: false,
    langDir: 'locales',
    locales: [
      { code: 'pl', language: 'pl-PL', name: 'Polski', file: 'pl.json' },
      { code: 'en', language: 'en-US', name: 'English', file: 'en.json' },
      { code: 'de', language: 'de-DE', name: 'Deutsch', file: 'de.json' },
    ],
    strategy: 'prefix_and_default',
    detectBrowserLanguage: false,
    customRoutes: 'config',
    pages: {
      about: {
        pl: '/o-klubie',
        en: '/about',
        de: '/ueber-uns',
      },
      events: {
        pl: '/wydarzenia',
        en: '/events',
        de: '/veranstaltungen',
      },
      'events-special': {
        pl: '/wydarzenia/specjalne',
        en: '/events/special',
        de: '/veranstaltungen/besondere',
      },
      'events-slug': {
        pl: '/wydarzenia/[slug]',
        en: '/events/[slug]',
        de: '/veranstaltungen/[slug]',
      },
    },
  },

Upvotes: 0

Views: 13

Answers (0)

Related Questions