Použití makra pro výpis receptu
parent
20d0c57c89
commit
4f88150e94
@ -0,0 +1,20 @@
|
||||
{% 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 %}
|
Loading…
Reference in New Issue