Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

184
Visualizações
Next.js i18n static generation also adds defaultLocale as subpath

We are trying to add locales using SSG according to the docs: https://nextjs.org/docs/advanced-features/i18n-routing#dynamic-routes-and-getstaticprops-pages

Our config is:

i18n: {
    locales: ['sv', 'en'],
    defaultLocale: 'sv',
  },

According to the docs, the defaultLocale should be rendered at the root. So when we return the path like this (according to the docs):

export const getStaticPaths = ({ locales }) => {
  return {
    paths: [
      // if no `locale` is provided only the defaultLocale will be generated
      { params: { slug: 'foo' } },
    ],
    fallback: true,
  }
}

It will build a /blog/foo in Swedish. However, when we visit /sv/blog/foo (after build & start) it will show the same page, and it also says so in the build summary:

├ ● /blog/[slug] (367292 ms)                            1.33 kB         372 kB
├   ├ /sv/blog/foo (12555 ms)

It seems odd that next generates duplicate pages for static sites with dynamic routes, and I can’t find anything that explains this. Does anyone know if this is a feature or bug?

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda