Revert overwritting page.target

This commit is contained in:
Catalin Constantin Mititiuc 2025-06-16 20:18:05 -07:00
parent 052fc35670
commit 115cc65d4a

View File

@ -79,16 +79,13 @@ list_posts = (args={}) =>
limit = math.min args.limit or #pages, #pages
return for page in *pages[1, limit]
-- overwrite with our extension-less targets so that urls generated with
-- page\url_for! omit the file extension
page.target = page.meta.target
{ title: title, id: id, publish_date: date, blurb: blurb } = page.meta
common.fill_ignoring_pre template,
title: title or titleize_slug id
publish_date: date
blurb: blurb
url: page\url_for!
url: rootname page\url_for!
-- call like this from a template: $(get_posts())[[<p>$title</p>]]
-- or like this: $(get_posts({limit = 5}))[[<p>$title</p>]]
@ -105,7 +102,7 @@ get_posts = (args={}) =>
title: title or titleize_slug id
publish_date: date
blurb: blurb
url: page\url_for!
url: rootname page\url_for!
}
-- replace '$if' helper function with cosmo's 'cif'