summaryrefslogtreecommitdiffstats
path: root/scripts/metadata.lua
diff options
context:
space:
mode:
authorVolpeon <git@volpeon.ink>2022-07-10 18:51:39 +0200
committerVolpeon <git@volpeon.ink>2022-07-10 18:51:39 +0200
commit31992bdba775fc3022a858ace9743620e70aee17 (patch)
tree5946c1e2edfcad8d3b36b1e1fd554e0a6c2f39db /scripts/metadata.lua
parentAdd support for custom emojis (diff)
downloadvolpeon.ink-31992bdba775fc3022a858ace9743620e70aee17.tar.gz
volpeon.ink-31992bdba775fc3022a858ace9743620e70aee17.tar.bz2
volpeon.ink-31992bdba775fc3022a858ace9743620e70aee17.zip
Fixed date handling
Diffstat (limited to 'scripts/metadata.lua')
-rw-r--r--scripts/metadata.lua22
1 files changed, 11 insertions, 11 deletions
diff --git a/scripts/metadata.lua b/scripts/metadata.lua
index 8f32bd4..4b77541 100644
--- a/scripts/metadata.lua
+++ b/scripts/metadata.lua
@@ -187,8 +187,8 @@ function d1_page_to_list_item(meta, p)
187 return { 187 return {
188 title = p.title, 188 title = p.title,
189 subtitle = p.subtitle, 189 subtitle = p.subtitle,
190 date = p.date, 190 date = meta.list_order == "date_desc" and p.date,
191 last_update = p.last_update, 191 last_update = meta.list_order == "date_desc" and p.last_update,
192 schema_type = p.schema_type, 192 schema_type = p.schema_type,
193 position = p.position, 193 position = p.position,
194 url = p.url, 194 url = p.url,
@@ -206,8 +206,8 @@ function d2_page_to_list_item(meta, cat, p, set_cat_title)
206 title = p.title, 206 title = p.title,
207 subtitle = p.subtitle, 207 subtitle = p.subtitle,
208 category = set_cat_title and cat.title, 208 category = set_cat_title and cat.title,
209 date = p.date, 209 date = cat.list_order == "date_desc" and p.date,
210 last_update = p.last_update, 210 last_update = cat.list_order == "date_desc" and p.last_update,
211 schema_type = p.schema_type, 211 schema_type = p.schema_type,
212 position = p.position, 212 position = p.position,
213 url = p.url, 213 url = p.url,
@@ -316,18 +316,18 @@ function process(global, meta)
316 meta.depth = find_depth(meta.pages) 316 meta.depth = find_depth(meta.pages)
317 meta.layout = prep_layout(meta.layout or (meta.redirect and "redirect") or resolve_layout(meta.depth)) 317 meta.layout = prep_layout(meta.layout or (meta.redirect and "redirect") or resolve_layout(meta.depth))
318 318
319 if meta.date then
320 meta.date = format_date(meta.date)
321 elseif meta.pages and #meta.pages.date_desc ~= 0 then
322 meta.date = meta.pages.date_desc[1].date
323 end
324
325 if meta.last_update then 319 if meta.last_update then
326 meta.last_update = format_date(meta.last_update) 320 meta.last_update = format_date(meta.last_update)
327 elseif meta.pages and #meta.pages.date_desc ~= 0 then 321 elseif meta.pages and #meta.pages.date_desc ~= 0 then
328 meta.last_update = meta.pages.date_desc[1].last_update 322 meta.last_update = meta.pages.date_desc[1].last_update
329 elseif meta.date then 323 elseif meta.date then
330 meta.last_update = meta.date 324 meta.last_update = format_date(meta.date)
325 end
326
327 if meta.date then
328 meta.date = format_date(meta.date)
329 elseif meta.last_update then
330 meta.date = meta.last_update
331 end 331 end
332 332
333 meta.list = generate_list(meta) 333 meta.list = generate_list(meta)