Skip to content

Commit 28fcb18

Browse files
committed
chore(docs): use vitepress sitemap feature
For some reason, using `lastUpdated` results in a `git ENOENT` error. So disabling that feature for now until I've time to investigate.
1 parent 7b0ecfb commit 28fcb18

File tree

1 file changed

+4
-29
lines changed

1 file changed

+4
-29
lines changed

docs/.vitepress/config.js

Lines changed: 4 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
import { processDirectoryRecursiveSync } from "@compas/stdlib";
2-
import { resolve } from "node:path";
3-
import { readdirSync, writeFileSync } from "node:fs";
1+
import { readdirSync } from "node:fs";
42
import { defineConfig } from "vitepress";
53

64
export default defineConfig({
@@ -38,7 +36,7 @@ export default defineConfig({
3836
["link", { rel: "shortcut icon", href: "/favicon/favicon.ico" }],
3937
["meta", { name: "theme-color", content: "#3EAF7C" }],
4038
],
41-
lastUpdated: true,
39+
lastUpdated: false,
4240

4341
themeConfig: {
4442
logo: "/compas-icon.svg",
@@ -109,31 +107,8 @@ export default defineConfig({
109107
envDir: process.cwd() + "/docs",
110108
},
111109

112-
buildEnd: (config) => {
113-
const outFile = resolve(config.outDir, "sitemap.xml");
114-
const baseUrl = "https://compasjs.com/";
115-
116-
let sitemap = `<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:news="http://www.google.com/schemas/sitemap-news/0.9" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:mobile="http://www.google.com/schemas/sitemap-mobile/1.0" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1" xmlns:video="http://www.google.com/schemas/sitemap-video/1.1">`;
117-
118-
processDirectoryRecursiveSync(config.outDir, (f) => {
119-
if (!f.endsWith(".html")) {
120-
return;
121-
}
122-
123-
if (f.includes("404.html")) {
124-
return;
125-
}
126-
127-
const path = f.split("/dist/").pop();
128-
sitemap += `<url>
129-
<loc>${baseUrl}${path}</loc>
130-
<lastmod>${new Date().toISOString()}</lastmod>
131-
<changefreq>daily</changefreq>
132-
<priority>0.7</priority>
133-
</url>`;
134-
});
135-
sitemap += `</urlset>`;
136-
writeFileSync(outFile, sitemap);
110+
sitemap: {
111+
hostname: "https://compasjs.com",
137112
},
138113
});
139114

0 commit comments

Comments
 (0)