iamvishnusankar/next-sitemap

`getServerSideSitemap` does not sanitise `&` and throws error

graemegeorge opened this issue · 1 comments

Describe the bug
Further to the fix here, #207 I've found that the error still throws when using getServerSideSitemap. I was able to resolve it by applying .replace(/&/g, '&'); myself, but this feels like a degraded experience.

To Reproduce
Steps to reproduce the behavior:

  1. use a loc with an ampersand
    return getServerSideSitemap([
      {
            loc: 'http://localhost:3000/en-us/burger-&-fries',
            lastmod: new Date().toISOString(),
            changefreq: 'daily',
        }
    ]);

Expected behavior

  • URLs with & should be sanatized when using getServerSideSitemap

Screenshots

v4.2.3 Workaround
CleanShot 2024-03-08 at 13 04 36 CleanShot 2024-03-08 at 13 04 54

Additional context
Add any other context about the problem here.

Closing this issue due to inactivity.