diff options
| author | Dennis Fink | 2026-08-17 19:36:16 +0200 |
|---|---|---|
| committer | Dennis Fink | 2026-08-17 20:00:16 +0200 |
| commit | 2b2d89ffd233e331a6985fe762ac339befc972a3 (patch) | |
| tree | 29f4850886342743cfef6231395f66529fb196b2 | |
| parent | be8614b3c5f63b9e94341166567b9198746f98aa (diff) | |
| download | dennisfink.me-2b2d89ffd233e331a6985fe762ac339befc972a3.tar.gz dennisfink.me-2b2d89ffd233e331a6985fe762ac339befc972a3.zip | |
Add post changelogs
This replaces the manual `updated_date` field with a changelog flow
field so post updates can be recorded as dated entries.
The blog template now derives the "Last updated" metadata from the
latest changelog entry and renders the full changelog in the article
footer, with dedicated styling for compact change notes.
| -rw-r--r-- | assets/static/css/style.css | 30 | ||||
| -rw-r--r-- | content/blog/hiking-log-1-circuit-korspronk/contents.lr | 8 | ||||
| -rw-r--r-- | flowblocks/changelog.ini | 14 | ||||
| -rw-r--r-- | models/blog-post.ini | 13 | ||||
| -rw-r--r-- | templates/blocks/changelog.html | 1 | ||||
| -rw-r--r-- | templates/blog-post.html | 9 | ||||
| -rw-r--r-- | templates/macros/blog.html | 51 |
7 files changed, 99 insertions, 27 deletions
diff --git a/assets/static/css/style.css b/assets/static/css/style.css index 00e9ee3..dd1ed80 100644 --- a/assets/static/css/style.css +++ b/assets/static/css/style.css @@ -684,6 +684,36 @@ article { li:not(:first-child) { white-space: nowrap; } + + .changelog { + margin-top: 1.5rem; + font-size: 0.85rem; + + & > h3 { + font-size: clamp(1.2rem, 2vw, 1.5rem); + margin: 0 0 0.75rem; + } + + & > ul { + margin: 0; + padding: 0; + list-style: none; + + & > li { + display: grid; + grid-template-columns: max-content 1fr; + gap: 1rem; + + & + li { + margin-top: 0.4rem; + } + + & > time { + color: var(--dim-blue); + } + } + } + } } /* --- Article separator --- */ diff --git a/content/blog/hiking-log-1-circuit-korspronk/contents.lr b/content/blog/hiking-log-1-circuit-korspronk/contents.lr index 7d0a08c..f495c89 100644 --- a/content/blog/hiking-log-1-circuit-korspronk/contents.lr +++ b/content/blog/hiking-log-1-circuit-korspronk/contents.lr @@ -58,7 +58,7 @@ The only disadvantage is that I cannot filter them by length or difficulty. This prompted me to do some more research, which led me to [Wanderweeër Lëtzebuerg (WWL)](https://wwl.lu/index.php/en/wwl-homepage), an independent project run by a Luxembourgish hiking enthusiast. -[Here](https://wwl.lu/index.php/en/dynamic-search), we can filter trails by +[Here](https://wwl.lu/index.php/en/hiking-trails), we can filter trails by keyword, category, distance and difficulty. I looked around to find an easy, short local hike and found the *"Circuit Korspronk"*. #### trail #### @@ -185,4 +185,10 @@ several others, which I will document in the future. I already feel that hiking helps me to switch off for a few moments by simply taking in the fresh air and paying attention to the beautiful, intricate, and sometimes mysterious natural world around me. +--- +changelog: +#### changelog #### +date: 2026-08-17 +---- +description: Fixed the link to the Wanderweeër Lëtzebuerg search page. diff --git a/flowblocks/changelog.ini b/flowblocks/changelog.ini new file mode 100644 index 0000000..3883ca4 --- /dev/null +++ b/flowblocks/changelog.ini @@ -0,0 +1,14 @@ +[block] +name = Changelog entry +button_label = Add changelog entry + +[fields.date] +label = Date +type = date +width = 1/3 +required = true + +[fields.description] +label = Description +type = string +width = 2/3 diff --git a/models/blog-post.ini b/models/blog-post.ini index 006376b..4a91868 100644 --- a/models/blog-post.ini +++ b/models/blog-post.ini @@ -10,12 +10,7 @@ size = large [fields.publication_date] label = Publication date type = date -width = 1/2 - -[fields.updated_date] -label = Updated date -type = date -width = 1/2 +width = 1 [fields.category] label = Category @@ -46,3 +41,9 @@ label = Body type = flow flow_blocks = markdown, trail, gallery description = Build the post from Markdown sections, trail maps or galleries. + +[fields.changelog] +label = Changelog +type = flow +flow_blocks = changelog +description = Record changes made to the post after publication. diff --git a/templates/blocks/changelog.html b/templates/blocks/changelog.html new file mode 100644 index 0000000..eee2bf1 --- /dev/null +++ b/templates/blocks/changelog.html @@ -0,0 +1 @@ +{# Changelog entries are rendered by the blog post template. #} diff --git a/templates/blog-post.html b/templates/blog-post.html index fe751ae..a8eaf37 100644 --- a/templates/blog-post.html +++ b/templates/blog-post.html @@ -13,6 +13,7 @@ {% endfor %} {% set needs_trail_assets = features.trail %} +{% set latest_change = this.changelog.blocks | max(attribute="date") if this.changelog else none %} {% block meta %} {{ super() }} @@ -22,9 +23,9 @@ <meta property="article:published_time" content="{{ this.publication_date }}T00:00:00+02:00"> {% endif %} - {% if this.updated_date %} + {% if latest_change %} <meta property="article:modified_time" - content="{{ this.updated_date }}T00:00:00+02:00"> + content="{{ latest_change.date }}T00:00:00+02:00"> {% endif %} {% if this.category %} {% set category = site.get("/categories/" + this.category) %} @@ -46,8 +47,8 @@ {% set blog_url = '/blog' | url(absolute=True, external=True) %} {% set blog_id = blog_url ~ '#blog' %} {% set modified_date = this.publication_date %} - {% if this.updated_date %} - {% set modified_date = this.updated_date %} + {% if latest_change %} + {% set modified_date = latest_change.date %} {% endif %} {% set post_description = bag('blog.tagline') %} {% if this.description %} diff --git a/templates/macros/blog.html b/templates/macros/blog.html index 13c2526..d076762 100644 --- a/templates/macros/blog.html +++ b/templates/macros/blog.html @@ -29,6 +29,8 @@ {% endfor %} {% endif %} + {% set latest_change = post.changelog.blocks | max(attribute="date") if post.changelog else none %} + <article class="h-entry"> <header> <div> @@ -54,12 +56,12 @@ </dd> </div> {% endif %} - {% if post.updated_date and post.publication_date and (post.updated_date > post.publication_date) %} + {% if latest_change and post.publication_date and latest_change.date > post.publication_date %} <div> <dt>Last updated:</dt> <dd> - <time datetime="{{ post.updated_date | dateformat('yyyy-MM-dd') }}" - class="dt-updated">{{ post.updated_date | dateformat("d MMMM yyyy") }}</time> + <time datetime="{{ latest_change.date | dateformat('yyyy-MM-dd') }}" + class="dt-updated">{{ latest_change.date | dateformat("d MMMM yyyy") }}</time> </dd> </div> {% endif %} @@ -82,20 +84,37 @@ {% endif %} </header> <div class="e-content">{{ post.body }}</div> - {% if post.tags %} + {% if post.tags or post.changelog %} <footer> - <ul aria-label="Tags"> - <li>Tagged with</li> - {% for tag in post.tags %} - <li> - {% set tag_slug = tag|trim|lower|replace(" ", "-") %} - <a href="{{ ('/blog/tag/' ~ tag_slug ~ '/')|url }}" - rel="tag" - class="p-category">{{ tag }}</a> - {%- if not loop.last -%}, {%- else -%}.{%- endif -%} - </li> - {% endfor %} - </ul> + {% if post.tags %} + <ul aria-label="Tags"> + <li>Tagged with</li> + {% for tag in post.tags %} + <li> + {% set tag_slug = tag|trim|lower|replace(" ", "-") %} + <a href="{{ ('/blog/tag/' ~ tag_slug ~ '/')|url }}" + rel="tag" + class="p-category">{{ tag }}</a> + {%- if not loop.last -%}, {%- else -%}.{%- endif -%} + </li> + {% endfor %} + </ul> + {% endif %} + {% if post.changelog %} + <section class="changelog" aria-labelledby="changelog-heading"> + <h3 id="changelog-heading">Changelog</h3> + <ul> + {% for entry in post.changelog.blocks %} + <li> + <time datetime="{{ entry.date | dateformat('yyyy-MM-dd') }}"> + {{ entry.date | dateformat("d MMMM yyyy") }} + </time> + <span>{{ entry.description }}</span> + </li> + {% endfor %} + </ul> + </section> + {% endif %} </footer> {% endif %} </article> |
