Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

177
Vistas
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 la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda