diff options
| author | Volpeon <git@volpeon.ink> | 2022-08-04 12:08:04 +0200 |
|---|---|---|
| committer | Volpeon <git@volpeon.ink> | 2022-08-04 12:08:04 +0200 |
| commit | c2ddbce74e8ae0f2f688497715e2382704ae7300 (patch) | |
| tree | 24d9ddaa24f1efa46192c246d04cd7f25fcd8c46 /scripts | |
| parent | Made parent page accessible; more flexible main menu by using patterns insted... (diff) | |
| download | volpeon.ink-c2ddbce74e8ae0f2f688497715e2382704ae7300.tar.gz volpeon.ink-c2ddbce74e8ae0f2f688497715e2382704ae7300.tar.bz2 volpeon.ink-c2ddbce74e8ae0f2f688497715e2382704ae7300.zip | |
Show page date depending on list layout
Diffstat (limited to 'scripts')
| -rw-r--r-- | scripts/metadata.lua | 10 | ||||
| -rw-r--r-- | scripts/page.lua | 4 |
2 files changed, 8 insertions, 6 deletions
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) | |||
| 76 | local pages_date_desc = pandoc.List() | 76 | local pages_date_desc = pandoc.List() |
| 77 | 77 | ||
| 78 | for id, p in pairs(meta.pages) do | 78 | for id, p in pairs(meta.pages) do |
| 79 | process(global, build, p) | 79 | process(global, build, p, meta) |
| 80 | 80 | ||
| 81 | if not p.unlisted then | 81 | if not p.unlisted then |
| 82 | pages_all:insert(id) | 82 | pages_all:insert(id) |
| @@ -126,7 +126,7 @@ function resolve_dates(meta) | |||
| 126 | meta.was_updated = meta.date and meta.last_update and meta.date.yyyy_mm_dd ~= meta.last_update.yyyy_mm_dd | 126 | meta.was_updated = meta.date and meta.last_update and meta.date.yyyy_mm_dd ~= meta.last_update.yyyy_mm_dd |
| 127 | end | 127 | end |
| 128 | 128 | ||
| 129 | function process_base(build, meta) | 129 | function process_base(build, meta, parent) |
| 130 | meta.namespace = prep_namespace(meta.namespace) | 130 | meta.namespace = prep_namespace(meta.namespace) |
| 131 | meta.file_out = utils.stringify(meta.file_out) | 131 | meta.file_out = utils.stringify(meta.file_out) |
| 132 | meta.unlisted = meta.unlisted or (meta.draft and build.mode ~= "dev") | 132 | meta.unlisted = meta.unlisted or (meta.draft and build.mode ~= "dev") |
| @@ -136,13 +136,15 @@ function process_base(build, meta) | |||
| 136 | meta.slug = slug(meta.title) | 136 | meta.slug = slug(meta.title) |
| 137 | meta.schema_type = meta.schema_type or "CreativeWork" | 137 | meta.schema_type = meta.schema_type or "CreativeWork" |
| 138 | meta.list_layout = prep_layout(meta.list_layout or "list") | 138 | meta.list_layout = prep_layout(meta.list_layout or "list") |
| 139 | meta.list_order = meta.list_order and utils.stringify(meta.list_order) | ||
| 139 | meta.position = meta.position and tonumber(utils.stringify(meta.position)) | 140 | meta.position = meta.position and tonumber(utils.stringify(meta.position)) |
| 140 | meta.thumbnail = meta.thumbnail and make_absolute("thumbnail." .. utils.stringify(meta.thumbnail), meta.file_out) | 141 | meta.thumbnail = meta.thumbnail and make_absolute("thumbnail." .. utils.stringify(meta.thumbnail), meta.file_out) |
| 141 | meta.layout = prep_layout(meta.layout or (meta.redirect and "redirect") or resolve_layout(meta.depth)) | 142 | meta.layout = prep_layout(meta.layout or (meta.redirect and "redirect") or resolve_layout(meta.depth)) |
| 143 | meta.show_date = parent and parent.list_order == "date_desc" | ||
| 142 | end | 144 | end |
| 143 | 145 | ||
| 144 | function process(global, build, meta) | 146 | function process(global, build, meta, parent) |
| 145 | process_base(build, meta) | 147 | process_base(build, meta, parent) |
| 146 | process_pages(global, build, meta) | 148 | process_pages(global, build, meta) |
| 147 | resolve_dates(meta) | 149 | resolve_dates(meta) |
| 148 | end | 150 | end |
diff --git a/scripts/page.lua b/scripts/page.lua index 3df55ec..3f77464 100644 --- a/scripts/page.lua +++ b/scripts/page.lua | |||
| @@ -73,7 +73,7 @@ function d1_page_to_list_item(meta, p) | |||
| 73 | subtitle = p.subtitle, | 73 | subtitle = p.subtitle, |
| 74 | date = p.date, | 74 | date = p.date, |
| 75 | last_update = p.last_update, | 75 | last_update = p.last_update, |
| 76 | show_date = meta.list_order == "date_desc", | 76 | show_date = p.show_date, |
| 77 | schema_type = p.schema_type, | 77 | schema_type = p.schema_type, |
| 78 | draft = p.draft, | 78 | draft = p.draft, |
| 79 | position = p.position, | 79 | position = p.position, |
| @@ -94,7 +94,7 @@ function d2_page_to_list_item(meta, cat, p, set_cat_title) | |||
| 94 | category = set_cat_title and cat.title, | 94 | category = set_cat_title and cat.title, |
| 95 | date = p.date, | 95 | date = p.date, |
| 96 | last_update = p.last_update, | 96 | last_update = p.last_update, |
| 97 | show_date = cat.list_order == "date_desc", | 97 | show_date = p.show_date, |
| 98 | schema_type = p.schema_type, | 98 | schema_type = p.schema_type, |
| 99 | draft = p.draft, | 99 | draft = p.draft, |
| 100 | position = p.position, | 100 | position = p.position, |
