Skip to content

Commit 878ee21

Browse files
committed
generate site map
1 parent 2dae3a9 commit 878ee21

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

generateRoutes.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ import path from "path";
33
import fs from "fs";
44

55
const indexPage = fs.readFileSync("./dist/index.html", "utf-8");
6+
const BASE_URL = "https://lnreader.github.io/";
7+
let siteMapContent = "";
68
for (const route of routes) {
79
const routePage = indexPage
810
.replace(/<title>.+<\/title>/, `<title>${route.title}</title>`)
@@ -16,4 +18,6 @@ for (const route of routes) {
1618
fs.mkdirSync(dir, { recursive: true });
1719
}
1820
fs.writeFileSync(filePath, routePage, "utf-8");
21+
siteMapContent += `${BASE_URL}${route.path}\n`;
1922
}
23+
fs.writeFileSync("./dist/sitemap.txt", siteMapContent, "utf-8");

0 commit comments

Comments
 (0)