validate settings + use 'date' by default + mention default in comments

This commit is contained in:
welpo 2024-07-11 23:16:05 +02:00
parent f3946dc7c6
commit 77a4b5ff80
No known key found for this signature in database
GPG key ID: A2F978CF4EC1F5A6
3 changed files with 11 additions and 5 deletions

View file

@ -147,10 +147,10 @@ show_reading_time = true
show_date = true
# Determines how dates are displayed in the post listing (e.g. front page or /blog). Options:
# "date" - Show only the original date of the post.
# "date" - Show only the original date of the post (default if unset).
# "updated" - Show only the last updated date of the post.
# "both" - Show both the original date and the last updated date.
post_listing_date = "both"
post_listing_date = "date"
# DEPRECATED!
# Use Zola's built-in `bottom_footnotes = true` in the [markdown] section instead. (Available since v0.19.0)

View file

@ -14,8 +14,14 @@
{% endif %}
<ul class="bloglist-meta">
{%- set show_date = post.date and config.extra.post_listing_date == "date" or post.date and config.extra.post_listing_date == "both" -%}
{%- set show_updated = post.updated and config.extra.post_listing_date == "updated" or post.updated and config.extra.post_listing_date == "both" -%}
{%- set allowed_post_listing_dates = ["date", "updated", "both"] -%}
{%- set post_listing_date = config.extra.post_listing_date | default(value="date") -%}
{%- if post_listing_date not in allowed_post_listing_dates -%}
{{ throw(message="ERROR: Invalid value for config.extra.post_listing_date. Allowed values are 'date', 'updated', or 'both'.") }}
{%- endif -%}
{%- set show_date = post.date and post_listing_date == "date" or post.date and post_listing_date == "both" -%}
{%- set show_updated = post.updated and post_listing_date == "updated" or post.updated and post_listing_date == "both" -%}
{%- if show_date or show_updated -%}
{%- if show_date -%}

View file

@ -104,7 +104,7 @@ show_reading_time = true
show_date = true
# Determines how dates are displayed in the post listing (e.g. front page or /blog). Options:
# "date" - Show only the original date of the post.
# "date" - Show only the original date of the post (default if unset).
# "updated" - Show only the last updated date of the post.
# "both" - Show both the original date and the last updated date.
post_listing_date = "date"