fix(v2): Fix double trailingSlash in sitemap.xml (#4004)

When `trailingSlash` option is enabled, routes that already end in a `/` are shown with double slash at the end.
This commit is contained in:
Nathan Bosscher 2021-01-06 09:44:22 -05:00 committed by GitHub
parent 89a2ba7732
commit 8a9dfcf96c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -24,7 +24,7 @@ export default function createSitemap(
.filter((route) => !route.endsWith('404.html'))
.map(
(routesPath): SitemapItemOptions => ({
url: `${routesPath}${trailingSlash && routesPath !== '/' ? '/' : ''}`,
url: `${routesPath}${trailingSlash && !routesPath.endsWith('/') ? '/' : ''}`,
changefreq,
priority,
}),