cards.html now uses fi macro

This commit is contained in:
eclipse 2025-03-06 10:38:31 +01:00
parent caead5cfc1
commit 371e42ea0c
2 changed files with 8 additions and 11 deletions

View File

@ -11,12 +11,11 @@
<h3><a href="{{ SITEURL }}/{{ article.save_as }}" title="{{ article.title }}">{{ article.title }}</a></h3>
</header>
<div class="card-body">
{% from 'includes/featured_image.html' import fi %}
{% if article.featured_image %}
<a href="{{ SITEURL }}/{{ article.save_as }}" title="{{ article.title }}"><img alt='Titelbild zu "{{ article.title }}"' src="{{ SITEURL }}/{{ article.featured_image[0].pic }}" /></a>
{% set i = article.featured_image[0] %}
{{ fi(i.pic, i.link | default("/" + article.save_as), i.alt | default("Titelbild von " + article.title), i.title | default(article.title), i.credit) }}
{% endif %}
{# {% if article.summary %}
<p>{{ article.summary }}</p>
{% endif %} #}
</div>
</article>
{% endfor %}

View File

@ -1,10 +1,8 @@
{% macro fi(pic, link='', alt='', credit='') %}
{% macro fi(pic, link='', alt='', title='', credit='') %}
<div class="featured-image">
<figure>
{% if link %}<a href="{{ link }}"{% if alt %} alt="{{ alt }}"{% endif %}>{% endif %}<img src="{{ pic }}" />{% if link %}</a>{% endif %}
{% if credit %}
<figcaption>Bild: {{ credit }}</figcaption>
{% endif %}
{% if link %}<a href="{{ link }}"{% if alt %} alt="{{ alt }}"{% endif %}>{% endif %}<img src="{{ pic }}" title="{{ title }}"/>{% if link %}</a>{% endif %}
{% if credit %}<figcaption>Bild: {{ credit }}</figcaption>{% endif %}
</figure>
</div>
{% endmacro %}