From c2ddbce74e8ae0f2f688497715e2382704ae7300 Mon Sep 17 00:00:00 2001 From: Volpeon Date: Thu, 4 Aug 2022 12:08:04 +0200 Subject: Show page date depending on list layout --- scripts/metadata.lua | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'scripts/metadata.lua') diff --git a/scripts/metadata.lua b/scripts/metadata.lua index 5157677..afd0ca5 100644 --- a/scripts/metadata.lua +++ b/scripts/metadata.lua @@ -76,7 +76,7 @@ function process_pages(global, build, meta) local pages_date_desc = pandoc.List() for id, p in pairs(meta.pages) do - process(global, build, p) + process(global, build, p, meta) if not p.unlisted then pages_all:insert(id) @@ -126,7 +126,7 @@ function resolve_dates(meta) meta.was_updated = meta.date and meta.last_update and meta.date.yyyy_mm_dd ~= meta.last_update.yyyy_mm_dd end -function process_base(build, meta) +function process_base(build, meta, parent) meta.namespace = prep_namespace(meta.namespace) meta.file_out = utils.stringify(meta.file_out) meta.unlisted = meta.unlisted or (meta.draft and build.mode ~= "dev") @@ -136,13 +136,15 @@ function process_base(build, meta) meta.slug = slug(meta.title) meta.schema_type = meta.schema_type or "CreativeWork" meta.list_layout = prep_layout(meta.list_layout or "list") + meta.list_order = meta.list_order and utils.stringify(meta.list_order) meta.position = meta.position and tonumber(utils.stringify(meta.position)) meta.thumbnail = meta.thumbnail and make_absolute("thumbnail." .. utils.stringify(meta.thumbnail), meta.file_out) meta.layout = prep_layout(meta.layout or (meta.redirect and "redirect") or resolve_layout(meta.depth)) + meta.show_date = parent and parent.list_order == "date_desc" end -function process(global, build, meta) - process_base(build, meta) +function process(global, build, meta, parent) + process_base(build, meta, parent) process_pages(global, build, meta) resolve_dates(meta) end -- cgit v1.2.3-70-g09d2