Make tags optional

This commit is contained in:
Maëlig 2022-12-15 11:24:57 +01:00
parent c828d149e8
commit e3e3e1648d

View file

@ -15,27 +15,28 @@
<div class="l-container"> <div class="l-container">
<div class="c-card__wrapper"> <div class="c-card__wrapper">
{% for recipe in collections.recipes %} {% for recipe in collections.recipes %}
{% if not selectedTag or selectedTag in recipe.data.tags %} {# If we don't have a selectedTag, we are on the all recipes page #} <div class="c-card">
<div class="c-card"> {% recipeimage recipe.data.image, "c-card__image", recipe.data.title, "(min-width: 1150px) 25vw, (min-width: 850px) 33vw, (min-width: 550px) 50vw, 100vw" %}
{% recipeimage recipe.data.image, "c-card__image", recipe.data.title, "(min-width: 1150px) 25vw, (min-width: 850px) 33vw, (min-width: 550px) 50vw, 100vw" %} <div class="c-card__info">
<div class="c-card__info"> {% if not recipe.data.tags | length %}
<div> <div>
{% for tag in recipe.data.tags %} {% for tag in recipe.data.tags %}
<abbr class="c-card__tag-abbr" title="{{ tag | noEmoji }}">{{ tag | onlyEmoji | safe }}</abbr> <abbr class="c-card__tag-abbr" title="{{ tag | noEmoji }}">{{ tag | onlyEmoji | safe }}</abbr>
{% endfor %} {% endfor %}
</div> </div>
{% if recipe.data.time %}
<div class="card__time"> {% endif %}
{% include 'icons/time.svg' %} {% if recipe.data.time %}
{{ recipe.data.time }} <div class="card__time">
</div> {% include 'icons/time.svg' %}
{% endif %} {{ recipe.data.time }}
</div> </div>
<a class="c-card__title-wrapper" href="{{ recipe.url }}"> {% endif %}
<h3 class="c-card__title">{{ recipe.data.title }}</h3>
</a>
</div> </div>
{% endif %} <a class="c-card__title-wrapper" href="{{ recipe.url }}">
<h3 class="c-card__title">{{ recipe.data.title }}</h3>
</a>
</div>
{% endfor %} {% endfor %}
</div> </div>
</div> </div>
@ -45,7 +46,7 @@
<div class="l-container"> <div class="l-container">
{% include 'components/taglist.njk' %} {% include 'components/taglist.njk' %}
</div> </div>
</section> </section>
{% endif %} {% endif %}
</main> </main>
{% endblock %} {% endblock %}