www: use frontmatter parser from std (#621)

This commit is contained in:
Benny Yen
2022-08-23 13:26:44 +00:00
committed by GitHub
parent 67b82d538b
commit d798db2a5f
2 changed files with 3 additions and 6 deletions
+2 -5
View File
@@ -38,11 +38,8 @@ export const handler: Handlers<Data> = {
}
const url = new URL(`../../../${entry.file}`, import.meta.url);
const fileContent = await Deno.readTextFile(url);
const { content, data } = frontMatter(fileContent) as {
data: Record<string, string>;
content: string;
};
const page = { ...entry, markdown: content, data: data ?? {} };
const { body, attrs } = frontMatter<Record<string, unknown>>(fileContent);
const page = { ...entry, markdown: body, data: attrs ?? {} };
const resp = ctx.render({ page });
return resp;
},