forked from SSWConsulting/SSW.Website
-
Notifications
You must be signed in to change notification settings - Fork 0
/
next-sitemap.config.js
68 lines (65 loc) · 1.74 KB
/
next-sitemap.config.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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
/** @type {import('next-sitemap').IConfig} */
module.exports = {
siteUrl: process.env.SITE_URL,
changefreq: "daily",
priority: 0.7,
sitemapSize: 5000,
generateRobotsTxt: true,
output: "standalone",
additionalPaths: async () => {
const otherURLs = [
"https://blog.ssw.com.au/",
"https://tv.ssw.com/",
"https://www.ssw.com.au/rules/",
];
return otherURLs.map((url) => ({
loc: url,
changefreq: "daily",
priority: 0.7,
lastmod: new Date().toISOString(),
trailingSlash: true,
}));
},
transform: async (config, path) => {
if (path.includes("/home")) {
return {
loc: path.replace("/home", "/"),
changefreq: config.changefreq,
priority: 1.0,
lastmod: config.lastmod || new Date().toISOString(),
};
} else if (path.includes("/500") || path.includes("/404")) {
return null;
}
return {
loc: path,
changefreq: config.changefreq,
priority: config.priority,
lastmod: config.lastmod || new Date().toISOString(),
};
},
robotsTxtOptions: {
policies: [
{
userAgent: "*",
allow: "/",
disallow: [
"/404",
"/500",
"/ssw/Redirect",
"/ssw/CodeAuditor",
"/ssw/Version.aspx",
"/ssw/LinkAuditor",
],
},
],
additionalSitemaps: [
"https://www.ssw.com.au/people/sitemap-index.xml",
"https://www.ssw.com.au/rules/sitemap-index.xml",
"https://www.ssw.com.au/archive/sitemap-index.xml",
// Removed v1 sitemap as its a duplication of bunch of Next.js pages - coming from
// "https://www.ssw.com.au/ssw/sitemap.xml",
// "https://www.ssw.com.au/history/sitemap.xml",
],
},
};