From 1000ef90b621da0ea5b28cf136bdc786620154b4 Mon Sep 17 00:00:00 2001 From: MTRNord Date: Thu, 13 Feb 2025 17:12:21 +0100 Subject: [PATCH] Initial archive page --- config.toml | 3 +- content/blog/archive/_index.md | 3 ++ templates/archive.html | 56 ++++++++++++++++++++++++++++++++ templates/shortcodes/figure.html | 2 +- 4 files changed, 62 insertions(+), 2 deletions(-) create mode 100644 content/blog/archive/_index.md create mode 100644 templates/archive.html diff --git a/config.toml b/config.toml index 2a1c09cd9..874ad14ac 100644 --- a/config.toml +++ b/config.toml @@ -25,6 +25,8 @@ taxonomies = [ highlight_code = true highlight_theme = "visual-studio-dark" +lazy_async_image = true + [link_checker] skip_prefixes = [ # This page is not a real page. You need to open https://circu.li/fdroid/repo/index-v1.json for a response @@ -49,4 +51,3 @@ conference_location = "Berlin, Germany" governence_board_elections = false governence_board_elections_page = "/governing-board/elections/2024" - diff --git a/content/blog/archive/_index.md b/content/blog/archive/_index.md new file mode 100644 index 000000000..b1a35cfd8 --- /dev/null +++ b/content/blog/archive/_index.md @@ -0,0 +1,3 @@ ++++ +template = "archive.html" ++++ diff --git a/templates/archive.html b/templates/archive.html new file mode 100644 index 000000000..fcefac560 --- /dev/null +++ b/templates/archive.html @@ -0,0 +1,56 @@ +{% extends "section.html" %} +{% block content -%} +{% set blog_section = get_section(path="blog/_index.md") %} +
+ {% set_global all_pages = [] %} + + {% for year_section_name in blog_section.subsections %} + {% set year_section = get_section(path=year_section_name) %} + {% set_global all_pages = all_pages | concat(with=year_section.pages) %} + {% endfor %} + {% set posts_by_year = all_pages | group_by(attribute="year") %} + + {% set_global years = [] %} + {% for year, ignored in posts_by_year %} + {% set_global years = years | concat(with=year) %} + {% endfor %} + + {% for year in years | sort | reverse %} + {% set posts = posts_by_year[year] | sort(attribute="date") | reverse %} +

{{ year }}

+
+ {% for page in posts %} +
+
+

{{ page.title }}

+ + {{ page.date | date(format="%d.%m.%Y %H:%M") }} + {% if page.taxonomies.category -%} + — + {% for category in page.taxonomies.category %} + + {{- category -}} + + {%- if not loop.last %}, {% endif %}{% endfor %} + {% endif %} + — + {% for author in page.taxonomies.author %} + + {{- author | default(value=["unknown author"]) -}} + + {%- if not loop.last %}, {% endif %} + {% endfor %} + + {% if page.updated -%} +
+ Last update: {{ page.updated | date(format="%d.%m.%Y %H:%M") }} + {%- endif %} +
+
+ {{ page.content | safe }} +
+
+ {% endfor %} + {% endfor %} +
+{%- endblock content %} diff --git a/templates/shortcodes/figure.html b/templates/shortcodes/figure.html index 76f450a61..7bfbd82c5 100644 --- a/templates/shortcodes/figure.html +++ b/templates/shortcodes/figure.html @@ -1,4 +1,4 @@
- {{ caption }} + {{ caption }}
{{ caption | markdown | safe }}
\ No newline at end of file