re: Auto-Generate sitemap.xml in Next.js VIEW POST

FULL DISCUSSION
 

Thanks! I think there's a bug in the code:

${Object.keys(pathsObj).map(
path => <url>
<loc>https://embiem.me${path}</loc>
<lastmod>${
formatDate(new Date(pathsObj[path].lastModified))
}</lastmod>
</url>

)}

Should be:

${Object.keys(pathsObj).map(
path => <url>
<loc>https://embiem.me${path}</loc>
<lastmod>${
formatDate(new Date(pathsObj[path].lastModified))
}</lastmod>
</url>

).join("")}

The original version is outputting commas between each XML element.

code of conduct - report abuse