feat: allow setting post_listing_date per section

This commit is contained in:
welpo 2025-02-09 23:16:53 +01:00
parent db5062fb3f
commit a3ae897c83
No known key found for this signature in database
GPG key ID: A2F978CF4EC1F5A6
4 changed files with 15 additions and 2 deletions

View file

@ -68,7 +68,9 @@
{%- if "dates" in metadata -%}
{%- set allowed_post_listing_dates = ["date", "updated", "both"] -%}
{%- set post_listing_date = config.extra.post_listing_date | default(value="date") -%}
{#- Calling the hierarchy macro here causes an error due to the "get parents" part of the macro. -#}
{#- This seems cleaner. -#}
{%- set post_listing_date = section.extra.post_listing_date | default(value=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 -%}