From 4a13dd4156d6468cbfd5139cdf12410bc9c3b07d Mon Sep 17 00:00:00 2001 From: Volpeon Date: Thu, 16 Dec 2021 12:19:50 +0100 Subject: Support generic list layouts --- content/profiles/index.md | 2 +- content/projects/drawings/index.md | 1 + content/projects/emojis/index.md | 1 + content/projects/index.md | 8 ++++---- scripts/metadata_filter.lua | 5 +++-- templates/layouts/categorized_list.html | 2 +- templates/layouts/list.html | 2 +- 7 files changed, 12 insertions(+), 9 deletions(-) diff --git a/content/profiles/index.md b/content/profiles/index.md index 0d8df9f..3007c62 100644 --- a/content/profiles/index.md +++ b/content/profiles/index.md @@ -1,6 +1,6 @@ --- title: Profiles position: 1 -list_grid: true +list_layout: grid list_post_icon: arrow-up-right --- diff --git a/content/projects/drawings/index.md b/content/projects/drawings/index.md index d87fc73..643a6ad 100644 --- a/content/projects/drawings/index.md +++ b/content/projects/drawings/index.md @@ -1,6 +1,7 @@ --- title: Drawings icon: image +list_layout: grid list_post_icon: arrow-right list_order: date_desc feed: true diff --git a/content/projects/emojis/index.md b/content/projects/emojis/index.md index f2aec09..6ef4559 100644 --- a/content/projects/emojis/index.md +++ b/content/projects/emojis/index.md @@ -1,6 +1,7 @@ --- title: Emojis icon: smile +list_layout: grid list_post_icon: arrow-right list_order: date_desc feed: true diff --git a/content/projects/index.md b/content/projects/index.md index 88e5a69..748126d 100644 --- a/content/projects/index.md +++ b/content/projects/index.md @@ -1,8 +1,8 @@ --- -title: Projects -position: 2 -list_grid: true -feed: true +title: Projects +position: 2 +list_layout: grid +feed: true --- A selection of projects I wasn't too lazy to create a page for. diff --git a/scripts/metadata_filter.lua b/scripts/metadata_filter.lua index d5a2909..a3675d9 100644 --- a/scripts/metadata_filter.lua +++ b/scripts/metadata_filter.lua @@ -215,7 +215,7 @@ function generate_list(meta) description = (cat.description and pandoc.MetaBlocks(pandoc.Para(cat.description))) or (not cat.no_description and cat.content), url = cat.url, - grid = cat.list_grid, + layout = cat.list_layout, items = items, total = tostring(#allItems), omitted = omitted ~= 0 and tostring(omitted), @@ -259,7 +259,7 @@ function generate_list(meta) description = (cat.description and pandoc.MetaBlocks(pandoc.Para(cat.description))) or (not cat.no_description and cat.content), url = cat.url, - grid = cat.list_grid, + layout = cat.list_layout, items = items, total = tostring(#allItems), omitted = omitted ~= 0 and tostring(omitted), @@ -276,6 +276,7 @@ function process(global, meta) meta.url = resolve_url(global.site.url, global.file_out, meta.url or meta.file_out) meta.title = (meta.title and pandoc.utils.stringify(meta.title)) or "" if meta.list_order then meta.list_order = pandoc.utils.stringify(meta.list_order) end + meta.list_layout = meta.list_layout and prep_layout(meta.list_layout) if meta.position then meta.position = pandoc.utils.stringify(meta.position) end if meta.feed then diff --git a/templates/layouts/categorized_list.html b/templates/layouts/categorized_list.html index 7d53cbe..73e75f3 100644 --- a/templates/layouts/categorized_list.html +++ b/templates/layouts/categorized_list.html @@ -13,7 +13,7 @@ $body$ $if(it.description)$ $endif$ - $if(it.grid)$ + $if(it.layout.is_grid)$
$it.items:partials/grid_card()$
diff --git a/templates/layouts/list.html b/templates/layouts/list.html index f3e5768..32aa35a 100644 --- a/templates/layouts/list.html +++ b/templates/layouts/list.html @@ -5,7 +5,7 @@ $body$
- $if(list_grid)$ + $if(list_layout.is_grid)$
$list:partials/grid_card()$
-- cgit v1.2.3-70-g09d2