Add sitemap, generated at build time
This commit is contained in:
parent
9f46000eff
commit
452799192a
34
next-sitemap.config.js
Normal file
34
next-sitemap.config.js
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
/** @type {import('next-sitemap').IConfig} */
|
||||||
|
const fetch = (...args) => import('node-fetch').then(({default: fetch}) => fetch(...args));
|
||||||
|
|
||||||
|
const MOD_SEARCH_INDEX_URL = 'https://mods.modmapper.com/mod_search_index.json';
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
siteUrl: process.env.SITE_URL || 'https://modmapper.com',
|
||||||
|
generateRobotsTxt: true,
|
||||||
|
additionalPaths: async (config) => {
|
||||||
|
console.log("additional paths");
|
||||||
|
const result = []
|
||||||
|
|
||||||
|
const response = await fetch(MOD_SEARCH_INDEX_URL);
|
||||||
|
const index = await response.json();
|
||||||
|
|
||||||
|
for (const mod of index) {
|
||||||
|
result.push({
|
||||||
|
loc: '/?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
|
||||||
|
},
|
||||||
|
}
|
3720
package-lock.json
generated
3720
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -4,6 +4,7 @@
|
|||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "next dev",
|
"dev": "next dev",
|
||||||
"build": "next build",
|
"build": "next build",
|
||||||
|
"postbuild": "next-sitemap --config next-sitemap.config.js",
|
||||||
"start": "next start",
|
"start": "next start",
|
||||||
"lint": "next lint"
|
"lint": "next lint"
|
||||||
},
|
},
|
||||||
@ -26,6 +27,8 @@
|
|||||||
"@types/react-dom": "^17.0.11",
|
"@types/react-dom": "^17.0.11",
|
||||||
"eslint": "8.6.0",
|
"eslint": "8.6.0",
|
||||||
"eslint-config-next": "12.0.8",
|
"eslint-config-next": "12.0.8",
|
||||||
|
"next-sitemap": "^2.1.14",
|
||||||
|
"node-fetch": "^3.2.0",
|
||||||
"typescript": "4.5.4"
|
"typescript": "4.5.4"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user