-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsitemap.ts
58 lines (53 loc) · 1.6 KB
/
sitemap.ts
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
import { type MetadataRoute } from "next";
import { getAccounts } from "../data";
import { riotRegionToUserRegion, supportedUserRegions } from "../regions";
export default async function sitemap(): Promise<MetadataRoute.Sitemap> {
const baseUrl = "https://www.dodgetracker.com";
const regions = Array.from(supportedUserRegions).map((region) => {
return {
url: `${baseUrl}/${region}`,
lastModified: new Date(),
changeFrequency: "always" as const, // Explicitly typing as a literal
priority: 1,
};
});
const leaderboards = Array.from(supportedUserRegions).map((region) => {
return {
url: `${baseUrl}/${region}/leaderboard`,
lastModified: new Date(),
changeFrequency: "hourly" as const, // Explicitly typing as a literal
priority: 1,
};
});
// const accounts = await getAccounts();
const accounts = await (async function () {
const accounts = await getAccounts();
return accounts.map((account) => {
return {
url: encodeURI(
`${baseUrl}/${riotRegionToUserRegion(account.riotRegion)}/${account.gameName}-${account.tagLine}`,
),
lastModified: account.lastDodgeTime,
changeFrequency: "hourly" as const, // Explicitly typing as a literal
priority: 0.8,
};
});
})();
return [
{
url: `${baseUrl}/`,
lastModified: new Date(),
changeFrequency: "always",
priority: 1,
},
{
url: `${baseUrl}/about`,
lastModified: new Date(),
changeFrequency: "weekly",
priority: 1,
},
...regions,
...leaderboards,
...accounts,
];
}