-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathnext-sitemap.config.js
More file actions
48 lines (45 loc) · 1.07 KB
/
next-sitemap.config.js
File metadata and controls
48 lines (45 loc) · 1.07 KB
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
/** @type {import('next-sitemap').IConfig} */
module.exports = {
siteUrl: "https://saltanalysis.com",
generateRobotsTxt: true,
generateIndexSitemap: true,
changefreq: 'weekly',
priority: 0.7,
exclude: ['/api/*'],
robotsTxtOptions: {
additionalSitemaps: [
'https://saltanalysis.com/server-sitemap.xml'
],
policies: [
{
userAgent: '*',
allow: '/',
disallow: ['/api/*']
}
]
},
transform: async (config, path) => {
// Custom priority and changefreq for different types of pages
let priority = 0.7;
let changefreq = 'weekly';
if (path === '/') {
priority = 1.0;
changefreq = 'daily';
} else if (path.startsWith('/salt/')) {
priority = 0.9;
changefreq = 'monthly';
} else if (path.startsWith('/category/')) {
priority = 0.8;
changefreq = 'weekly';
}
// Add lastmod date
const lastmod = new Date().toISOString();
return {
loc: path,
changefreq,
priority,
lastmod,
alternateRefs: config.alternateRefs ?? [],
}
},
}