Skip to content

Commit 755ec76

Browse files
committedNov 18, 2019
fix: omit router data before sitemap creation
1 parent 3f58560 commit 755ec76

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed
 

‎lib/builder.js

+10-5
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,16 @@ function createSitemap(options, routes, base = null, req = null) {
5050
})
5151
}
5252

53-
// Normalize to absolute path each route URL
54-
routes = routes.map(route => ({
55-
...route,
56-
url: join('.', route.url)
57-
}))
53+
routes = routes.map(route => {
54+
// Omit the router data
55+
const { children, chunkName, component, name, path, ...sitemapOptions } = route
56+
57+
// Normalize to absolute path
58+
return {
59+
...sitemapOptions,
60+
url: join('.', sitemapOptions.url)
61+
}
62+
})
5863

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

0 commit comments

Comments
 (0)
Please sign in to comment.