import * as fs from "fs-extra";
import path from "path";
import { Plugin } from "../core/plugin";
export const sitemapPlugin: Plugin = {
postbuild: async (base) => {
let content = "";
for (const doc of base.documents) {
content += ``;
content += `${doc.getSlug()}`;
if (doc.lastEdit) {
content += `${doc.lastEdit.toISOString()}`;
}
content += `weekly`;
content += ``;
}
content = `${content}`;
await fs.writeFile(path.join(base.getOutDir(), "sitemap.xml"), content);
},
};