Added support for adding update dates to blog posts

This commit is contained in:
squidfunk
2023-08-01 19:10:11 +02:00
parent 013b373c8e
commit 04bde62c91
5 changed files with 35 additions and 7 deletions

View File

@@ -87,6 +87,18 @@
</div>
</li>
<!-- Page date updated -->
{% if page.meta.date_updated %}
<li class="md-nav__item">
<div class="md-nav__link">
{% include ".icons/material/calendar-clock.svg" %}
<time datetime="{{ page.meta.date_updated }}" class="md-ellipsis">
{{- page.meta.date_updated_format -}}
</time>
</div>
</li>
{% endif %}
<!-- Page categories -->
{% if page.categories %}
<li class="md-nav__item">

View File

@@ -358,6 +358,12 @@ class BlogPlugin(BasePlugin[BlogConfig]):
page.meta["date"], date_format, config
)
# Format date of last update for rendering
if "date_updated" in page.meta:
page.meta["date_updated_format"] = self._format_date(
page.meta["date_updated"], date_format, config
)
# Compute readtime if desired and not explicitly set
if self.config.post_readtime: