diff options
-rw-r--r-- | src/posts.ts | 4 | ||||
-rw-r--r-- | src/templates.ts | 6 |
2 files changed, 5 insertions, 5 deletions
diff --git a/src/posts.ts b/src/posts.ts index e15accb..2b678b9 100644 --- a/src/posts.ts +++ b/src/posts.ts @@ -2,7 +2,6 @@ import path from "node:path"; import fs from "node:fs/promises"; import { matter } from "toml-matter"; -import * as marked from "marked"; type MatterFile = ReturnType<typeof matter>; @@ -30,7 +29,6 @@ export async function readPosts( let posts = new Array<Post>(); const subdir = path.join(root, inputDir); for (let pathname of await fs.readdir(subdir)) { - const pathFromDir = path.join(inputDir, pathname); const pathFromRoot = path.join(subdir, pathname); const stat = await fs.stat(pathFromRoot); if (stat.isFile() && path.extname(pathname) === ".md") { @@ -43,7 +41,7 @@ export async function readPosts( const file = await getPost(input); - (file.data.taxonomies as any)?.tags?.map((t: string) => + (file.data["taxonomies"] as any)?.tags?.map((t: string) => tags.add(t.toLowerCase()), ); posts.push({ diff --git a/src/templates.ts b/src/templates.ts index 4f8ab9f..2b6f589 100644 --- a/src/templates.ts +++ b/src/templates.ts @@ -111,7 +111,7 @@ async function renderPost(file: Post, content: string) { const categories = $(".h-entry .p-categories"); const cat = categories.find(".p-category").parentsUntil(categories); cat.remove(); - for (const tag of file.taxonomies.tags) { + for (const tag of file.taxonomies["tags"]) { categories.append( cat .clone() @@ -230,7 +230,9 @@ export default async function generateSite() { }); for (const tag of tags) { log.debug(`Processing tag ${tag}`); - const matchingPosts = posts.filter((p) => p.taxonomies.tags.includes(tag)); + const matchingPosts = posts.filter((p) => + p.taxonomies["tags"].includes(tag), + ); await fs.mkdir(`public/tags/${tag}`, { recursive: true }); tasks.push(async () => { log.debug(`Rendering tag ${tag} to public/tags/${tag}/index.html`); |