Změna logiky pro výběr obrázku receptu

This commit is contained in:
Emil Miler 2021-05-02 17:39:07 +02:00
parent 68aa36f416
commit 1f39452b3e

View File

@ -10,19 +10,15 @@
{% endif %} {% endif %}
> >
<a href="{{ recipe.permalink }}"> <a href="{{ recipe.permalink }}">
{% set_global image_found = 0 %} {% set_global image = "../static/temp.jpg" %}
{% for asset in recipe.assets %} {% for asset in recipe.assets %}
{% if asset is matching("[img.](jpg|png)$") %} {% if asset is matching("[img.](jpg|png)$") %}
<img src="{{ resize_image(path=asset, width=300, height=300, op="fill") }}" alt="Náhled"> {% set_global image = asset %}
{% set_global image_found = 1 %}
{% break %} {% break %}
{% endif %} {% endif %}
{% endfor %} {% endfor %}
{% if image_found == 0 %} <img src="{{ resize_image(path=image, width=300, height=300, op="fill") }}" alt="{{ recipe.title }}">
<img src="/temp.jpg" alt="Náhradní obrázek"> <h3>{{ recipe.title }}</h3>
{% endif %}
{% set_global image_found = 0 %}
{% if recipe.title %}<h3>{{ recipe.title }}</h3>{% endif %}
{% if recipe.date %}<span class="date">{{ recipe.date | date(format="%d.%m.%Y") }}</span>{% endif %} {% if recipe.date %}<span class="date">{{ recipe.date | date(format="%d.%m.%Y") }}</span>{% endif %}
</a> </a>
</article> </article>