fix(sitemap): correct prefix

This commit is contained in:
Bastian Ike
2023-01-19 11:23:45 +01:00
committed by Bastian
parent a48e0bb7db
commit 2c97343bb7
2 changed files with 16 additions and 7 deletions

View File

@@ -42,6 +42,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
Object.defineProperty(exports, "__esModule", { value: true });
var fs_1 = require("fs");
var xml_sitemap_1 = __importDefault(require("xml-sitemap"));
var config_1 = require("../src/config");
var radar_1 = require("./generateJson/radar");
// Do this as the first thing so that any code reading it knows the right env.
process.env.BABEL_ENV = "production";
@@ -75,9 +76,9 @@ var createStaticFiles = function () { return __awaiter(void 0, void 0, void 0, f
sitemap = new xml_sitemap_1.default();
radar.items.forEach(function (item) {
(0, fs_1.copyFileSync)("build/index.html", "build/".concat(item.quadrant, "/").concat(item.name, ".html"));
sitemap.add("".concat(process.env.PUBLIC_URL, "/").concat(item.quadrant, "/").concat(item.name, ".html"), {
lastmod: 'now',
changefreq: 'weekly'
sitemap.add("".concat(config_1.publicUrl).concat(item.quadrant, "/").concat(item.name, ".html"), {
lastmod: "now",
changefreq: "weekly",
});
});
(0, fs_1.writeFileSync)("build/sitemap.xml", sitemap.xml);

View File

@@ -1,6 +1,14 @@
#!/usr/bin/env node
import { copyFileSync, mkdirSync, existsSync, readFileSync, writeFileSync } from "fs";
import {
copyFileSync,
existsSync,
mkdirSync,
readFileSync,
writeFileSync,
} from "fs";
import XmlSitemap from "xml-sitemap";
import { publicUrl } from "../src/config";
import { createRadar } from "./generateJson/radar";
// Do this as the first thing so that any code reading it knows the right env.
@@ -39,9 +47,9 @@ const createStaticFiles = async () => {
`build/${item.quadrant}/${item.name}.html`
);
sitemap.add(`${process.env.PUBLIC_URL}/${item.quadrant}/${item.name}.html`, {
lastmod: 'now',
changefreq: 'weekly'
sitemap.add(`${publicUrl}${item.quadrant}/${item.name}.html`, {
lastmod: "now",
changefreq: "weekly",
});
});