Skip to content

Commit 271c813

Browse files
committed
localized sitemap file generation logic
1 parent 78d40ac commit 271c813

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

web/src/build/sitemap.ts

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,26 @@
1+
import { getCollection } from "@dzcode.io/data/dist/get/collection";
2+
import { allLanguages } from "@dzcode.io/models/dist/language";
13
import { createWriteStream } from "fs";
4+
import { join } from "path";
25
import { SitemapStream } from "sitemap";
6+
37
const distFolder = "./bundle";
4-
import { getCollection } from "@dzcode.io/data/dist/get/collection";
5-
import { join } from "path";
68

79
// Static URLs
810
console.log("Getting Static URLs ...");
9-
const urls = ["/", "/Contribute", "/Learn", "/Projects", "/Articles", "/FAQ"];
11+
const urls = ["/", "/Contribute", "/Learn", "/Projects", "/Articles", "/FAQ", "/Team"].reduce(
12+
(pV, uri) => [...pV, ...allLanguages.map(({ code }) => (code === "en" ? uri : `/${code}${uri}`))],
13+
[] as string[],
14+
);
1015
console.log("✅", urls.length, "URLs Found");
1116

1217
// Dynamic URLs
18+
// @TODO-ZM: to localize this
1319
console.log("Getting Dynamic URLs ...");
1420
[
1521
{ file: "articles", slug: "Articles" },
1622
{ file: "documentation", slug: "Learn" },
17-
{ file: "projects", slug: "Projects" },
23+
// { file: "projects", slug: "Projects" }, // @TODO-ZM: to put back when we have proper project details page
1824
].forEach((collectionInfo) => {
1925
const collection = getCollection<Record<string, string>>(
2026
join(__dirname, "../../../data"),

0 commit comments

Comments
 (0)