Refactor the 'for' loop that adds all the post files
This commit is contained in:
parent
111d3ea0a3
commit
d8d50c234a
@ -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: {
|
||||
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) for path, out in pairs posts "docs"
|
||||
id: extract_id(path)
|
||||
|
||||
-- replace post markdown yaml headers with moonscript headers
|
||||
filter "docs", (body) =>
|
||||
|
@ -4,7 +4,7 @@ $wrap{"blog"}
|
||||
<header>
|
||||
<div>
|
||||
<h2>$(title or id)</h2>
|
||||
<time>$(post.publish_date)</time>
|
||||
<time>$publish_date</time>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user