From 385db81296bccf0c9e4341580d96e6a868f9d7f0 Mon Sep 17 00:00:00 2001 From: Volpeon Date: Sat, 5 Jun 2021 17:12:33 +0200 Subject: Some design fixes, page list metadata improvements --- Makefile | 2 +- assets/css/_basics.scss | 5 ++ assets/css/_vars.scss | 4 +- assets/css/components/_footer.scss | 2 + assets/css/components/_post-list.scss | 5 +- content/9thPK7O3xn/dreams/index.md | 8 ++-- content/9thPK7O3xn/index.md | 2 +- content/9thPK7O3xn/misc/index.md | 6 ++- content/9thPK7O3xn/posts/index.md | 6 ++- scripts/metadata_filter.lua | 81 +++++++++++++++++++-------------- templates/base.html | 10 +++- templates/feed.xml | 6 +-- templates/feed_entry.xml | 58 +++++++++++------------ templates/layouts/categorized_list.html | 28 ++++++++---- templates/layouts/list.html | 41 +++++++++++++++++ templates/layouts/page.html | 2 +- 16 files changed, 175 insertions(+), 91 deletions(-) create mode 100644 templates/layouts/list.html diff --git a/Makefile b/Makefile index b2fcd6c..651401a 100644 --- a/Makefile +++ b/Makefile @@ -125,7 +125,7 @@ out/%.css: assets/css/%.scss $(CSS_SRC) | out sassc -t compressed "$<" | ./node_modules/.bin/postcss --use autoprefixer --no-map > "$@" -.cache/meta: .cache +.cache/meta: | .cache mkdir -p .cache/meta .cache: diff --git a/assets/css/_basics.scss b/assets/css/_basics.scss index 9a6a53e..fd15836 100644 --- a/assets/css/_basics.scss +++ b/assets/css/_basics.scss @@ -39,6 +39,11 @@ body { padding: 0; } +main { + display: flex; + flex-direction: column; +} + pre, code { font-family: $font-fam--mono; diff --git a/assets/css/_vars.scss b/assets/css/_vars.scss index 4dc709b..bf2097e 100644 --- a/assets/css/_vars.scss +++ b/assets/css/_vars.scss @@ -39,7 +39,7 @@ $content--width: 42rem; --outer: 4rem, --indent: 2rem, - --obj-shadow: 0 .4em 3.5em, + --obj-shadow: 0 .4em 2.8em, ), --colors: ( --bg-hi: $gray0, // Darker background @@ -76,7 +76,7 @@ $content--width: 42rem; --idle: var(--colors--fg-lo), --colored: ( --idle: hsl(220, 100%, 80%), //hsl(var(--colors--accent--h), 100%, 66%), // - --visited: hsl(290, 35%, 75%), //hsl(var(--colors--accent--h), 50%, 66%), // + --visited: hsl(290, 35%, 72%), //hsl(var(--colors--accent--h), 50%, 66%), // ) ), diff --git a/assets/css/components/_footer.scss b/assets/css/components/_footer.scss index 3705b79..cc0e827 100644 --- a/assets/css/components/_footer.scss +++ b/assets/css/components/_footer.scss @@ -9,7 +9,9 @@ @include component(namespace()) { position: relative; + flex: 0 0 auto; min-height: prop(--dims --outer, $global: true); + margin-top: auto; overflow: hidden; background-color: prop(--colors --bg); color: prop(--colors --fg); diff --git a/assets/css/components/_post-list.scss b/assets/css/components/_post-list.scss index 03b5e7a..ba4c5af 100644 --- a/assets/css/components/_post-list.scss +++ b/assets/css/components/_post-list.scss @@ -15,8 +15,11 @@ )); @include component(namespace()) { + margin-top: $line-height * 2rem; + @include element('category-header') { - color: prop(--colors --cat --fg); + margin-top: $line-height * 2rem; + color: prop(--colors --cat --fg); } @include element('category-content') { diff --git a/content/9thPK7O3xn/dreams/index.md b/content/9thPK7O3xn/dreams/index.md index fbe9a45..db7be1c 100644 --- a/content/9thPK7O3xn/dreams/index.md +++ b/content/9thPK7O3xn/dreams/index.md @@ -1,5 +1,7 @@ --- -title: Dream Journal -show_dates: true -position: 9 +title: Dream Journal +show_dates: true +position: 9 +layout: list +create_feed: true --- diff --git a/content/9thPK7O3xn/index.md b/content/9thPK7O3xn/index.md index 47e789b..0b14fcf 100644 --- a/content/9thPK7O3xn/index.md +++ b/content/9thPK7O3xn/index.md @@ -5,4 +5,4 @@ create_feed: true --- Welcome to the personal section of my website! -Here you will find content that doesn't belong in the public sections of my website, such as test pages for development purposes or content that's too personal in nature. +Here you will find content that doesn't belong in the public sections of my website, such as layout and design tests or pages about more personal topics. diff --git a/content/9thPK7O3xn/misc/index.md b/content/9thPK7O3xn/misc/index.md index 0fc9e44..0d79d44 100644 --- a/content/9thPK7O3xn/misc/index.md +++ b/content/9thPK7O3xn/misc/index.md @@ -1,4 +1,6 @@ --- -title: Other stuff -position: 10 +title: Other stuff +position: 10 +layout: list +create_feed: true --- diff --git a/content/9thPK7O3xn/posts/index.md b/content/9thPK7O3xn/posts/index.md index 592e730..eb2fb08 100644 --- a/content/9thPK7O3xn/posts/index.md +++ b/content/9thPK7O3xn/posts/index.md @@ -1,4 +1,6 @@ --- -title: Posts -position: 0 +title: Posts +position: 0 +layout: list +create_feed: true --- diff --git a/scripts/metadata_filter.lua b/scripts/metadata_filter.lua index 895139d..3bea687 100644 --- a/scripts/metadata_filter.lua +++ b/scripts/metadata_filter.lua @@ -106,11 +106,18 @@ end function process_pages(global, pages_by_id) if not pages_by_id then return nil end - local pages_list = pandoc.List() - - for _, page in pairs(pages_by_id) do pages_list:insert(process(global, page)) end + local pages_all = pandoc.List() + local pages_asc_title = pandoc.List() + local pages_desc_date = pandoc.List() + + for _, page in pairs(pages_by_id) do + local p = process(global, page) + pages_all:insert(p) + pages_asc_title:insert(p) + if p.date then pages_desc_date:insert(p) end + end - pages_list:sort(function(p1, p2) + pages_all:sort(function(p1, p2) if p1.position then if p2.position then return tonumber(p1.position) < tonumber(p2.position) @@ -132,36 +139,40 @@ function process_pages(global, pages_by_id) end end) - local pages_by_category = pages_list:filter(function(p) return p.category ~= nil end) - pages_by_category = group_by(pages_by_category, function(p) return p.category.id end, - function(data, _, p) - if not data then - local l = pandoc.List() - l:insert(p) - return { name = pandoc.utils.stringify(p.category.name), pages = l } + pages_desc_date:sort(function(p1, p2) + if p1.position then + if p2.position then + return tonumber(p1.position) < tonumber(p2.position) else - data.pages:insert(p) + return true end - end) - pages_by_category = table_to_list(pages_by_category, false, - function(i1, i2) return i1.name < i2.name end) - - local pages_data = { all = pages_list, by_id = pages_by_id, by_category = pages_by_category } - - return pages_data -end - -function pages_last_update(all_pages) - local last_update = format_date("1990-01-01") + else + return p1.date.yyyy_mm_dd > p2.date.yyyy_mm_dd + end + end) - for i = 1, #all_pages do - local page = all_pages[i] - if page.last_update and page.last_update.yyyy_mm_dd > last_update.yyyy_mm_dd then - last_update = page.last_update + pages_asc_title:sort(function(p1, p2) + if p1.position then + if p2.position then + return tonumber(p1.position) < tonumber(p2.position) + else + return true + end + elseif p2.position then + return false + else + return p1.title < p2.title end - end + end) + + local pages_data = { + all = pages_all, + desc_date = pages_desc_date, + asc_title = pages_asc_title, + by_id = pages_by_id, + } - return last_update + return pages_data end local titlecase_exceptions = pandoc.List({ @@ -208,20 +219,24 @@ function process(global, meta) meta.preview = resolve_url(global.site.url, global.file_out, meta.preview) end - if meta.date then meta.date = format_date(meta.date) end - if meta.menus and meta.menus.main then meta.menus.main = prep_menu(meta.namespace.root.id, meta.menus.main) end meta.pages = process_pages(global, meta.pages) + if meta.date then + meta.date = format_date(meta.date) + elseif meta.pages and #meta.pages.desc_date ~= 0 then + meta.date = meta.pages.desc_date[1].date + end + if meta.last_update then meta.last_update = format_date(meta.last_update) + elseif meta.pages and #meta.pages.desc_date ~= 0 then + meta.last_update = meta.pages.desc_date[1].last_update elseif meta.date then meta.last_update = meta.date - elseif meta.pages then - meta.last_update = pages_last_update(meta.pages.all) end return meta diff --git a/templates/base.html b/templates/base.html index 6c0c4a9..5542401 100644 --- a/templates/base.html +++ b/templates/base.html @@ -22,6 +22,13 @@ $if(feed)$ $endif$ + $if(layout.is_categorized_list)$ + $for(pages.asc_title)$ + $if(it.feed)$ + + $endif$ + $endfor$ + $endif$ $if(namespace.root.is_index)$$else$$title$ – $endif$$site.title$ @@ -64,11 +71,12 @@ ${layouts/index()} $elseif(layout.is_categorized_list)$ ${layouts/categorized_list()} + $elseif(layout.is_list)$ +${layouts/list()} $else$ ${layouts/page()} $endif$ -