-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathnext-sitemap.config.js
43 lines (36 loc) · 1.32 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
/** @type {import('next-sitemap').IConfig} */
const fetch = (...args) => import('node-fetch').then(({default: fetch}) => fetch(...args));
const SSE_MOD_SEARCH_INDEX_URL = 'https://mods.modmapper.com/skyrimspecialedition/mod_search_index.json';
const LE_MOD_SEARCH_INDEX_URL = 'https://mods.modmapper.com/skyrim/mod_search_index.json';
module.exports = {
siteUrl: process.env.SITE_URL || 'https://modmapper.com',
generateRobotsTxt: true,
additionalPaths: async (config) => {
const result = []
const skyrimResponse = await fetch(LE_MOD_SEARCH_INDEX_URL);
const skyrimIndex = await skyrimResponse.json();
const skyrimspecialeditionResponse = await fetch(SSE_MOD_SEARCH_INDEX_URL);
const skyrimspecialeditionIndex = await skyrimspecialeditionResponse.json();
for (const mod of skyrimIndex) {
result.push({
loc: `/?game=skyrim&mod=${mod.id}`,
changefreq: 'daily',
});
}
for (const mod of skyrimspecialeditionIndex) {
result.push({
loc: `/?game=skyrimspecialedition&mod=${mod.id}`,
changefreq: 'daily',
});
}
for (let x = -77; x < 75; x++) {
for (let y = -50; y < 44; y++) {
result.push({
loc: '/?cell=' + encodeURIComponent(`${x},${y}`),
changefreq: 'daily',
});
}
}
return result
},
}