diff options
Diffstat (limited to '')
| -rw-r--r-- | templates/macros/blog.html | 51 |
1 files changed, 35 insertions, 16 deletions
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> |
