This commit is contained in:
Catalin Constantin Mititiuc 2025-05-22 16:52:57 -07:00
parent 56be76b443
commit 6c60c1230e

View File

@ -126,16 +126,19 @@ test = (args={}, has_block) =>
-- page.template_stack = common.Stack! -- page.template_stack = common.Stack!
-- html\render page, assert args[1] or template, "missing html string" -- html\render page, assert args[1] or template, "missing html string"
listing_info = (page) ->
{ :title, :id, publish_date: pub_date, :blurb } = page.meta
title = title or titleize_slug id
url = rootname page\url_for!
{ title: title, publish_date: pub_date, blurb: blurb, url: url }
list3 = (args={}, has_block) => list3 = (args={}, has_block) =>
pages = @site\query_pages { is_a: "post" } pages = @site\query_pages { is_a: "post" }
table.sort pages, (a, b) -> a.source > b.source table.sort pages, (a, b) -> a.source > b.source
limit_or_page_count = math.min args.limit or #pages, #pages limit_or_page_count = math.min args.limit or #pages, #pages
result = for page in *pages[1, limit_or_page_count] result = for page in *pages[1, limit_or_page_count]
{ :title, :id, publish_date: pub_date, :blurb } = page.meta vals = listing_info page
title = title or titleize_slug id
url = rootname page\url_for!
vals = { title: title, publish_date: pub_date, blurb: blurb, url: url }
if has_block then cosmo.yield vals else common.fill_ignoring_pre template, vals if has_block then cosmo.yield vals else common.fill_ignoring_pre template, vals
return result unless has_block return result unless has_block