-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnext-sitemap.js
32 lines (31 loc) · 995 Bytes
/
next-sitemap.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
module.exports = {
siteUrl: 'https://mildinsanitytakestime.com',
changefreq: 'daily',
priority: 0.7,
sitemapSize: 5000,
generateRobotsTxt: true,
// Default transformation function
transform: async (config, path) => {
if (path === '/') return transformConfig(config, path, { priority: 1 })
if (path === '/pricing') return transformConfig(config, path, { priority: 0.8 })
return transformConfig(config, path)
},
robotsTxtOptions: {
policies: [
{
userAgent: '*',
allow: '/',
},
],
},
}
function transformConfig (config, path, overrites) {
const { priority, changefreq, alternateRefs } = overrites ?? {}
return {
loc: path, // => this will be exported as http(s)://<config.siteUrl>/<path>
changefreq: changefreq ?? config.changefreq,
priority: priority ?? config.priority,
lastmod: config.autoLastmod ? new Date().toISOString() : undefined,
alternateRefs: alternateRefs ?? config.alternateRefs ?? [],
}
}