Initial commit

This commit is contained in:
eggy committed 2022-07-21 16:50:03 -04:00
1 parent 182c3ce4dd
commit 2211879de0
106 files changed
+6270 -2948

No files matched your search

+11
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);
});