Použití makra pro výpis receptu

This commit is contained in:
Emil Miler
2021-02-02 22:01:42 +01:00
parent 20d0c57c89
commit 4f88150e94
5 changed files with 28 additions and 64 deletions

View File

@ -6,27 +6,7 @@
<hr>
<section class="list">
{% for page in term.pages %}
<article>
<a href="{{ page.permalink }}">
{% set_global image_found = 0 %}
{% for asset in page.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 %}
</a>
{% if page.title %}<a href="{{ page.permalink }}"><h3>{{ page.title }}</h3></a>{% endif %}
{% if page.date %}<span class="date">{{ page.date | date(format="%d.%m.%Y") }}</span>{% endif %}
</article>
{{ macro::print_recipe(recipe=page) }}
{% endfor %}
</section>
</main>