Initial commit

This commit is contained in:
2022-07-21 16:50:03 -04:00
parent 182c3ce4dd
commit 2211879de0
106 changed files with 6270 additions and 2948 deletions

View File

@@ -0,0 +1,11 @@
import { SitemapStream, streamToPromise } from "sitemap";
export default defineEventHandler(async (event) => {
// Fetch all documents
const docs = await serverQueryContent(event).find();
const sitemap = new SitemapStream({ hostname: "https://example.com" });
for (const doc of docs) {
sitemap.write({ url: doc._path, changefreq: "monthly" });
}
sitemap.end();
return streamToPromise(sitemap);
});