cal: set featured_image in template

This commit is contained in:
knoflook 2022-02-03 15:32:25 +01:00
parent 1f21d0475f
commit e32743ecd5
Signed by untrusted user: knoflook
GPG Key ID: D6A1D0E8FC4FEF1C
2 changed files with 6 additions and 0 deletions

View File

@ -75,6 +75,7 @@ def create_metadata(event):
"duration": date.compress(event.duration),
"location": event.location,
"uid": event.uid,
"featured_image": "",
"images": find_imageURLS(event.description), # currently not used in template
}
@ -158,6 +159,8 @@ def create_event_post(post_dir, event):
event_metadata["description"] = event_metadata["description"].replace(
img, "![]({})".format(img_name)
)
if event_metadata["featured_image"] == "":
event_metadata["featured_image"] = img_name
if img_name in existing_images:
existing_images.remove(img_name)

View File

@ -8,6 +8,9 @@ event_end: "{{ event.end }}"
duration: "{{ event.duration }}"
localized_begin: "{{ event.localized_begin }}"
uid: "{{ event.uid }}"
{% if event.featured_image %}
featured_image: "{{ event.featured_image }}"
{% endif %}
{% if event.location %}
location: "{{ event.location }}"
{% endif %}