shadowfacts.net/lib/generate/errors.ts

21 lines
525 B
TypeScript

import * as metadata from "../metadata";
import layout from "../layout";
import * as util from "../util";
export default async function errors() {
await generate("404.html");
await generate("500.html");
}
async function generate(filename: string) {
const page = await metadata.get(`site/${filename}.ejs`);
page.text = util.render(page.text, {
metadata: page.metadata
}, `site/${filename}.ejs`);
page.text = await layout(page.text, page.metadata, page.metadata.layout!);
await util.write(filename, page.text);
}