diff options
Diffstat (limited to 'scripts/metadata.lua')
-rw-r--r-- | scripts/metadata.lua | 13 |
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 |
43 | end | 43 | end |
44 | 44 | ||
45 | function prep_layout(layout) | ||
46 | layout = utils.stringify(layout) | ||
47 | return { id = layout, ["is_" .. layout] = true } | ||
48 | end | ||
49 | |||
50 | function prep_namespace(namespace) | 45 | function 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 |
184 | end | 179 | end |
185 | 180 | ||
186 | function Meta(meta) | 181 | function Meta(meta) |