From 077c8e41d82557bbfc20e30915c92811d25f516a Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 15 Apr 2024 23:13:58 +0200 Subject: sort tags --- src/templates.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/templates.ts b/src/templates.ts index 84ae695..8099065 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"].sort()) { categories.append( cat .clone() @@ -230,7 +230,10 @@ export default async function generateSite() { await fs.mkdir("public/tags", { recursive: true }); tasks.push(async () => { log.debug("Rendering tags page to public/tags/index.html"); - return fs.writeFile("public/tags/index.html", await renderTags([...tags])); + return fs.writeFile( + "public/tags/index.html", + await renderTags([...tags].sort()), + ); }); for (const tag of tags) { log.debug(`Processing tag ${tag}`); -- cgit 1.4.1