Skip to content

Commit

Permalink
fix: omit router data before sitemap creation
Browse files Browse the repository at this point in the history
  • Loading branch information
NicoPennec committed Nov 18, 2019
1 parent 3f58560 commit 755ec76
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions lib/builder.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,16 @@ function createSitemap(options, routes, base = null, req = null) {
})
}

// Normalize to absolute path each route URL
routes = routes.map(route => ({
...route,
url: join('.', route.url)
}))
routes = routes.map(route => {
// Omit the router data
const { children, chunkName, component, name, path, ...sitemapOptions } = route

// Normalize to absolute path
return {
...sitemapOptions,
url: join('.', sitemapOptions.url)
}
})

// Set urls and ensure they are unique
sitemapConfig.urls = [...new Set(routes)]
Expand Down

0 comments on commit 755ec76

Please sign in to comment.