Search code examples
reactjsurlnext.jsseositemap

NextJs - How to remove duplicate URL from sitemap generator?


In NextJs app, I am using nextjs-sitemap-generator package to handle sitemap. Here I am trying to avoid some duplicate URLs, how can I add it in ignoredPaths.

Eg: I have http://localhost/about/security and http://localhost/security, I want to remove only http://localhost/security, so If I add ignoredPaths: ['/security'] then both links will get remove.

Please help to solve this.

If I use next-sitemap package how can I do the same changes using exclude or other option?


Solution

  • Try with this regex!

    ignoredPaths: ["/admin", /^\/security/ ],