-
Notifications
You must be signed in to change notification settings - Fork 2
/
generateSitemap.js
27 lines (23 loc) · 1.27 KB
/
generateSitemap.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
let sitemap = "";
sitemap += '<?xml version="1.0" encoding="UTF-8"?>';
sitemap += '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">';
sitemap +=
"<url><loc>https://covid19nsw.ethan.link/cases/by-postcode</loc><changefreq>daily</changefreq></url>";
sitemap +=
"<url><loc>https://covid19nsw.ethan.link/vaccines/by-postcode</loc><changefreq>daily</changefreq></url>";
sitemap +=
"<url><loc>https://covid19nsw.ethan.link/cases/by-council</loc><changefreq>daily</changefreq></url>";
sitemap +=
"<url><loc>https://covid19nsw.ethan.link/vaccines/by-council</loc><changefreq>daily</changefreq></url>";
sitemap += "<url><loc>https://covid19nsw.ethan.link/about</loc></url>";
const postcodes = require("./src/data/built/postcodes.json");
for (const postcode of postcodes) {
sitemap += `<url><loc>https://covid19nsw.ethan.link/postcode/${postcode}</loc><changefreq>daily</changefreq></url>`;
}
const councilNames = require("./src/data/built/councilNames.json");
for (const councilName of councilNames) {
const councilSlug = councilName.replace(/ /g, "-").toLowerCase();
sitemap += `<url><loc>https://covid19nsw.ethan.link/council/${councilSlug}</loc><changefreq>daily</changefreq></url>`;
}
sitemap += "</urlset>";
require("fs").writeFileSync("./public/sitemap.xml", sitemap);