Use old way, it's better

This commit is contained in:
Catalin Constantin Mititiuc 2025-05-21 11:28:54 -07:00
parent 832ed344ca
commit a78da1b386

View File

@ -77,17 +77,12 @@ list_posts = (args={}) =>
posts = @site\query_pages { is_a: "post" }
table.sort posts, (a, b) -> a.source > b.source
return for page in *posts[1, args.limit or #posts]
page.tpl_scope = page\get_tpl_scope!
page.meta.title = page.meta.title or titleize_slug page.meta.id
page.template_stack = common.Stack!
page.template_stack\push @site.config.default_template
@renderer\render page, template
-- common.fill_ignoring_pre template,
-- target: meta.target
-- post_title: meta.title or titleize_slug meta.id
-- publish_date: publish_date source
-- blurb: meta.blurb
return for { meta: meta, source: source } in *posts[1, args.limit or #posts]
common.fill_ignoring_pre template,
target: meta.target
title: meta.title or titleize_slug meta.id
publish_date: publish_date source
blurb: meta.blurb
-- call like this from a template: $(get_posts())[[<p>$target</p>]]
-- or like this: $(get_posts({limit = 5}))[[<p>$target</p>]]