-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnext-sitemap.config.js
More file actions
42 lines (34 loc) · 1.12 KB
/
next-sitemap.config.js
File metadata and controls
42 lines (34 loc) · 1.12 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
const { dsaTopicPages } = require("./src/data/dsa/dsaTopicPages");
const { dsaProblems } = require("./src/data/dsa/dsaProblems");
const { languageContentMap } = require("./src/data/pl/allTopics");
const baseUrl = "https://jdcodebase.vercel.app";
const getDSATopicPaths = () =>
dsaTopicPages.map(
(t) => `/dsa/${t.title.toLowerCase().replace(/\s+/g, "-")}`
);
const getDSAProblemPaths = () =>
dsaProblems.flatMap((p) =>
p.category.map(
(cat) => `dsa/problem/${cat.toLowerCase().replace(/\s+/g, "-")}/${p.slug}`
)
);
const getLangTopicPaths = () =>
Object.entries(languageContentMap).flatMap(([lang, topics]) =>
topics.map((topic) => `/languages/${lang}/${topic.slug}`)
);
module.exports = {
siteUrl: baseUrl,
generateRobotsTxt: true,
sitemapSize: 5000,
exclude: [],
async additionalPaths(config) {
const dsaTopics = getDSATopicPaths();
const dsaProblems = getDSAProblemPaths();
const langTopics = getLangTopicPaths();
const all = [...langTopics, ...dsaTopics, ...dsaProblems];
return all.map((path) => ({
loc: path,
lastmod: new Date().toISOString(),
}));
},
};