From 7c655a95058aa753355251eb78b83d31d44972ab Mon Sep 17 00:00:00 2001 From: Volpeon Date: Tue, 23 Aug 2022 14:07:20 +0200 Subject: Better navigation of related content --- scripts/metadata.lua | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) (limited to 'scripts/metadata.lua') diff --git a/scripts/metadata.lua b/scripts/metadata.lua index 9c8a964..843ed3c 100644 --- a/scripts/metadata.lua +++ b/scripts/metadata.lua @@ -42,11 +42,6 @@ function resolve_layout(depth) return layout end -function prep_layout(layout) - layout = utils.stringify(layout) - return { id = layout, ["is_" .. layout] = true } -end - function prep_namespace(namespace) namespace = utils.stringify(namespace) @@ -138,11 +133,11 @@ function process_base(build, meta) meta.title = meta.title and utils.stringify(meta.title) or "" 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_layout = common.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.layout = common.prep_layout(meta.layout or (meta.redirect and "redirect") or resolve_layout(meta.depth)) meta.show_date = meta.parent and meta.parent.list_order == "date_desc" meta.category = meta.parent and meta.parent.title @@ -179,8 +174,8 @@ function find_pos(meta) if index == nil then return end - meta.prev = index >= 2 and pages[index - 1] or nil - meta.next = index <= #pages - 1 and pages[index + 1] or nil + meta.prev = index <= #pages - 1 and pages[index + 1] or nil + meta.next = index >= 2 and pages[index - 1] or nil end function Meta(meta) -- cgit v1.2.3-54-g00ecf