receptty.org/templates/macros.html
2021-02-03 22:27:09 +01:00

21 lines
713 B
HTML

{% macro print_recipe(recipe) %}
<article>
<a href="{{ recipe.permalink }}">
{% set_global image_found = 0 %}
{% 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 %}
{% 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 %}
</a>
{% if recipe.date %}<span class="date">{{ recipe.date | date(format="%d.%m.%Y") }}</span>{% endif %}
</article>
{% endmacro print_recipe %}