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

145
Visualizações
Nextjs Sitemap removing /en/ for all web links generated after build

I am using Strapi, it is pulled in JSON format.

Example of what a regular website link looks like: https:/ /www.some-site.com/some-link

What happens to my links after post build is done on my Nextjs project:

<url><loc>https://website-name.com/en/something-links</loc><changefreq>daily</changefreq><priority>0.7</priority><lastmod>2021-10-12T05:43:36.829Z</lastmod></url>

Now if you'll notice, the language (/en/) shows up on the link. I have created a next-sitemap.js file to try and remove this issue but it is not working.

Here is what the code in next-sitemap.js looks like:

next-sitemap.js

const defaultRegion = 'us';
module.exports = {
  siteUrl: process.env.NEXT_PUBLIC_SITE_URL,
  generateRobotsTxt: false,
  sitemapSize: 7000,
  transform: async (config, path) => {
    const defaultLocalePath = `/${defaultRegion}/`;
    let transformedPath = path;

    if (path.substring(0, defaultLocalePath.length) === defaultLocalePath) {
      transformedPath = path.substring(defaultLocalePath.length, path.length);
    }

    return {
      loc: transformedPath,
      changefreq: config.changefreq,
      priority: config.priority,
      lastmod: config.autoLastmod ? new Date().toISOString() : undefined,
      alternateRefs: config.alternateRefs ?? [],
    };
  },
};

I have over 200+ links and pages on my website.

I am receiving an error in the first line itself

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