From 878ee21e52700d98ae62292f71d50a9ebf4def1c Mon Sep 17 00:00:00 2001 From: nyagami Date: Sun, 23 Jun 2024 12:13:09 +0700 Subject: [PATCH] generate site map --- generateRoutes.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/generateRoutes.js b/generateRoutes.js index 08e1a68..ccacb19 100644 --- a/generateRoutes.js +++ b/generateRoutes.js @@ -3,6 +3,8 @@ import path from "path"; import fs from "fs"; const indexPage = fs.readFileSync("./dist/index.html", "utf-8"); +const BASE_URL = "https://lnreader.github.io/"; +let siteMapContent = ""; for (const route of routes) { const routePage = indexPage .replace(/.+<\/title>/, `<title>${route.title}`) @@ -16,4 +18,6 @@ for (const route of routes) { fs.mkdirSync(dir, { recursive: true }); } fs.writeFileSync(filePath, routePage, "utf-8"); + siteMapContent += `${BASE_URL}${route.path}\n`; } +fs.writeFileSync("./dist/sitemap.txt", siteMapContent, "utf-8");