summaryrefslogtreecommitdiffstats
path: root/scripts/metadata.lua
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/metadata.lua')
-rw-r--r--scripts/metadata.lua13
1 files changed, 4 insertions, 9 deletions
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)
42 return layout 42 return layout
43end 43end
44 44
45function prep_layout(layout)
46 layout = utils.stringify(layout)
47 return { id = layout, ["is_" .. layout] = true }
48end
49
50function prep_namespace(namespace) 45function prep_namespace(namespace)
51 namespace = utils.stringify(namespace) 46 namespace = utils.stringify(namespace)
52 47
@@ -138,11 +133,11 @@ function process_base(build, meta)
138 meta.title = meta.title and utils.stringify(meta.title) or "" 133 meta.title = meta.title and utils.stringify(meta.title) or ""
139 meta.slug = slug(meta.title) 134 meta.slug = slug(meta.title)
140 meta.schema_type = meta.schema_type or "CreativeWork" 135 meta.schema_type = meta.schema_type or "CreativeWork"
141 meta.list_layout = prep_layout(meta.list_layout or "list") 136 meta.list_layout = common.prep_layout(meta.list_layout or "list")
142 meta.list_order = meta.list_order and utils.stringify(meta.list_order) 137 meta.list_order = meta.list_order and utils.stringify(meta.list_order)
143 meta.position = meta.position and tonumber(utils.stringify(meta.position)) 138 meta.position = meta.position and tonumber(utils.stringify(meta.position))
144 meta.thumbnail = meta.thumbnail and make_absolute("thumbnail." .. utils.stringify(meta.thumbnail), meta.file_out) 139 meta.thumbnail = meta.thumbnail and make_absolute("thumbnail." .. utils.stringify(meta.thumbnail), meta.file_out)
145 meta.layout = prep_layout(meta.layout or (meta.redirect and "redirect") or resolve_layout(meta.depth)) 140 meta.layout = common.prep_layout(meta.layout or (meta.redirect and "redirect") or resolve_layout(meta.depth))
146 141
147 meta.show_date = meta.parent and meta.parent.list_order == "date_desc" 142 meta.show_date = meta.parent and meta.parent.list_order == "date_desc"
148 meta.category = meta.parent and meta.parent.title 143 meta.category = meta.parent and meta.parent.title
@@ -179,8 +174,8 @@ function find_pos(meta)
179 174
180 if index == nil then return end 175 if index == nil then return end
181 176
182 meta.prev = index >= 2 and pages[index - 1] or nil 177 meta.prev = index <= #pages - 1 and pages[index + 1] or nil
183 meta.next = index <= #pages - 1 and pages[index + 1] or nil 178 meta.next = index >= 2 and pages[index - 1] or nil
184end 179end
185 180
186function Meta(meta) 181function Meta(meta)