1
4
Fork 1

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

master
Emil Miler 3 years ago
parent 68aa36f416
commit 1f39452b3e

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

Loading…
Cancel
Save