Skip to content

Commit c5ed437

Browse files
chore(docs): update sitemap module config (#5348)
* chore(docs): update sitemap module config * lint * Update nuxt.config.js * Update nuxt.config.js * Update nuxt.config.js * Update nuxt.config.js * Update nuxt.config.js * Update nuxt.config.js Co-authored-by: Jacob Müller <jacob.mueller.elz@gmail.com>
1 parent 62c6105 commit c5ed437

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

docs/nuxt.config.js

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -296,16 +296,18 @@ module.exports = {
296296
},
297297

298298
// We only include a populated `sitemap.xml` in production docs
299-
sitemap: {
300-
// Sitemaps requires a hostname, so we use localhost in
301-
// non-prod mode just to make the sitemap module happy
302-
hostname: IS_PROD_DOCS ? BASE_URL : 'http://localhost',
303-
// Exclude all static routes when not prod
304-
// Exclude only redirect routes in prod
305-
exclude: IS_PROD_DOCS ? ['/docs/misc', '/docs/misc/**', '/docs/layout'] : ['/', '/**'],
306-
// Include dynamic slug routes (from `generate.routes`) in prod, while
307-
// in non-prod docs we do not include dynamic routes (empty array)
308-
...(IS_PROD_DOCS ? {} : { routes: [] })
299+
sitemap: () => {
300+
// Don't generate a sitemap for non-production docs
301+
if (!IS_PROD_DOCS) {
302+
return false
303+
}
304+
return {
305+
hostname: BASE_URL,
306+
// Exclude any redirect pages from sitemaps
307+
exclude: ['/docs/misc', '/docs/misc/**', '/docs/layout'],
308+
// Default properties to apply to each URL entry
309+
defaults: { changefreq: 'weekly', lastmod: new Date().toISOString() }
310+
}
309311
},
310312

311313
head: {

0 commit comments

Comments
 (0)