From d8d50c234ab28597ba08ecafea8216906f5d2a3b Mon Sep 17 00:00:00 2001 From: Catalin Constantin Mititiuc Date: Mon, 16 Jun 2025 20:18:05 -0700 Subject: [PATCH] Refactor the 'for' loop that adds all the post files --- site.moon | 10 +++++++--- templates/post.html | 2 +- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/site.moon b/site.moon index fb57173..6b30c3e 100644 --- a/site.moon +++ b/site.moon @@ -62,9 +62,13 @@ sitegen.create => add "index.html" add "blog.html", target: "posts/index", template: "blog" - add path, target: out, template: "post", is_a: "post", post: { - publish_date: publish_date(path) - }, id: extract_id(path) for path, out in pairs posts "docs" + for path, target in pairs posts "docs" + add path, + target: target + template: "post" + is_a: "post" + publish_date: publish_date(path) + id: extract_id(path) -- replace post markdown yaml headers with moonscript headers filter "docs", (body) => diff --git a/templates/post.html b/templates/post.html index b1e7660..702902b 100644 --- a/templates/post.html +++ b/templates/post.html @@ -4,7 +4,7 @@ $wrap{"blog"}

$(title or id)

- +