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

137
Views
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
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!