Inline posts list template

This commit is contained in:
Catalin Constantin Mititiuc 2025-06-16 20:18:05 -07:00
parent 0dc346f591
commit ee8d797a15

View File

@ -79,19 +79,17 @@ titleize_slug = (slug) ->
words = [{ titleize word } for word in *common.split slug, "-"] words = [{ titleize word } for word in *common.split slug, "-"]
table.concat [head .. tail for { head, tail } in *words], " " table.concat [head .. tail for { head, tail } in *words], " "
template = [[ list_posts = (page, args={}) ->
posts = page.site\query_pages { is_a: "post" }
table.sort posts, (a, b) -> a.source > b.source
table.concat [common.fill_ignoring_pre [[
<section> <section>
<h3><a href="$target">$post_title</a></h3> <h3><a href="$target">$post_title</a></h3>
<time>$publish_date</time> — $blurb <time>$publish_date</time> — $blurb
<a class="read-post-link" href="$target">Read post →</a> <a class="read-post-link" href="$target">Read post →</a>
</section> </section>
]] ]], {
list_posts = (page, args={}) ->
posts = page.site\query_pages { is_a: "post" }
table.sort posts, (a, b) -> a.source > b.source
table.concat [common.fill_ignoring_pre template, {
target: meta.target target: meta.target
post_title: meta.title or titleize_slug meta.id post_title: meta.title or titleize_slug meta.id
publish_date: publish_date source publish_date: publish_date source