-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnext-sitemap.config.js
More file actions
50 lines (44 loc) · 1.2 KB
/
next-sitemap.config.js
File metadata and controls
50 lines (44 loc) · 1.2 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
49
50
/** @type {import('next-sitemap').IConfig} */
module.exports = {
siteUrl: process.env.SITE_URL || 'https://nextandot.github.io',
generateRobotsTxt: true,
robotsTxtOptions: {
policies: [
{
userAgent: '*',
allow: '/',
},
],
},
generateIndexSitemap: false,
transform: async (config, path) => {
const defaultConfig = {
loc: path,
changefreq: config.changefreq,
priority: config.priority,
lastmod: config.autoLastmod ? new Date().toISOString() : undefined,
alternateRefs: config.alternateRefs ?? [],
};
// ホームページ
if (path === '/') {
return { ...defaultConfig, priority: 1.0 };
}
// アプリページ
if (path.startsWith('/apps')) {
return { ...defaultConfig, priority: 0.8 };
}
// ブログページ
if (path.startsWith('/blog')) {
return { ...defaultConfig, priority: 0.9, changefreq: 'weekly' };
}
// メンバーページ
if (path.startsWith('/members')) {
return { ...defaultConfig, priority: 0.7 };
}
// 検索ページ
if (path.startsWith('/search')) {
return { ...defaultConfig, priority: 0.6 };
}
return defaultConfig;
},
}