Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

176
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!