fix: include index.html in sitemap

closes #325
This commit is contained in:
Danny Koppenhagen
2023-02-06 21:27:19 +01:00
committed by Bastian
parent 5411e8c041
commit d2e540035a
2 changed files with 14 additions and 9 deletions

View File

@@ -54,7 +54,7 @@ process.on("unhandledRejection", function (err) {
throw err;
});
var createStaticFiles = function () { return __awaiter(void 0, void 0, void 0, function () {
var radar, rawConf, config, sitemap;
var radar, rawConf, config, sitemap, sitemapOptions;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
@@ -74,12 +74,14 @@ var createStaticFiles = function () { return __awaiter(void 0, void 0, void 0, f
}
});
sitemap = new xml_sitemap_1.default();
sitemapOptions = {
lastmod: "now",
changefreq: "weekly",
};
sitemap.add("".concat(config_1.publicUrl, "/index.html"), sitemapOptions);
radar.items.forEach(function (item) {
(0, fs_1.copyFileSync)("build/index.html", "build/".concat(item.quadrant, "/").concat(item.name, ".html"));
sitemap.add("".concat(config_1.publicUrl).concat(item.quadrant, "/").concat(item.name, ".html"), {
lastmod: "now",
changefreq: "weekly",
});
sitemap.add("".concat(config_1.publicUrl).concat(item.quadrant, "/").concat(item.name, ".html"), sitemapOptions);
});
(0, fs_1.writeFileSync)("build/sitemap.xml", sitemap.xml);
return [2 /*return*/];

View File

@@ -40,6 +40,12 @@ const createStaticFiles = async () => {
});
const sitemap = new XmlSitemap();
const sitemapOptions = {
lastmod: "now",
changefreq: "weekly",
}
sitemap.add(`${publicUrl}/index.html`, sitemapOptions);
radar.items.forEach((item) => {
copyFileSync(
@@ -47,10 +53,7 @@ const createStaticFiles = async () => {
`build/${item.quadrant}/${item.name}.html`
);
sitemap.add(`${publicUrl}${item.quadrant}/${item.name}.html`, {
lastmod: "now",
changefreq: "weekly",
});
sitemap.add(`${publicUrl}${item.quadrant}/${item.name}.html`, sitemapOptions);
});
writeFileSync("build/sitemap.xml", sitemap.xml);