Refactor the 'for' loop that adds all the post files
This commit is contained in:
parent
2a9c7e520c
commit
ce9d7e37e5
10
site.moon
10
site.moon
@ -62,9 +62,13 @@ sitegen.create =>
|
|||||||
add "index.html"
|
add "index.html"
|
||||||
add "blog.html", target: "posts/index", template: "blog"
|
add "blog.html", target: "posts/index", template: "blog"
|
||||||
|
|
||||||
add path, target: out, template: "post", is_a: "post", post: {
|
for path, target in pairs posts "docs"
|
||||||
publish_date: publish_date(path)
|
add path,
|
||||||
}, id: extract_id(path) for path, out in pairs posts "docs"
|
target: target
|
||||||
|
template: "post"
|
||||||
|
is_a: "post"
|
||||||
|
publish_date: publish_date(path)
|
||||||
|
id: extract_id(path)
|
||||||
|
|
||||||
-- replace post markdown yaml headers with moonscript headers
|
-- replace post markdown yaml headers with moonscript headers
|
||||||
filter "docs", (body) =>
|
filter "docs", (body) =>
|
||||||
|
@ -4,7 +4,7 @@ $wrap{"blog"}
|
|||||||
<header>
|
<header>
|
||||||
<div>
|
<div>
|
||||||
<h2>$(title or id)</h2>
|
<h2>$(title or id)</h2>
|
||||||
<time>$(post.publish_date)</time>
|
<time>$publish_date</time>
|
||||||
</div>
|
</div>
|
||||||
</header>
|
</header>
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user