From f58a99b04ba89b6a0f2e304e3f3ec10502603f6b Mon Sep 17 00:00:00 2001 From: maeligg Date: Tue, 27 Dec 2022 19:45:22 +0100 Subject: [PATCH] Fix filtering on tag pages --- src/_includes/layouts/recipes-list.njk | 42 ++++++++++++++------------ 1 file changed, 22 insertions(+), 20 deletions(-) diff --git a/src/_includes/layouts/recipes-list.njk b/src/_includes/layouts/recipes-list.njk index 961b663..102f82f 100644 --- a/src/_includes/layouts/recipes-list.njk +++ b/src/_includes/layouts/recipes-list.njk @@ -15,28 +15,30 @@
{% for recipe in collections.recipes %} -
- {% recipeimage recipe.data.image, "c-card__image", recipe.data.title, "(min-width: 1150px) 25vw, (min-width: 850px) 33vw, (min-width: 550px) 50vw, 100vw" %} -
- {% if not recipe.data.tags | length %} -
- {% for tag in recipe.data.tags %} - {{ tag | onlyEmoji | safe }} - {% endfor %} -
+ {% if not selectedTag or selectedTag in recipe.data.tags %} {# If we don't have a selectedTag, we are on the all recipes page #} +
+ {% recipeimage recipe.data.image, "c-card__image", recipe.data.title, "(min-width: 1150px) 25vw, (min-width: 850px) 33vw, (min-width: 550px) 50vw, 100vw" %} +
+ {% if not recipe.data.tags | length %} +
+ {% for tag in recipe.data.tags %} + {{ tag | onlyEmoji | safe }} + {% endfor %} +
- {% endif %} - {% if recipe.data.time %} -
- {% include 'icons/time.svg' %} - {{ recipe.data.time }} -
- {% endif %} + {% endif %} + {% if recipe.data.time %} +
+ {% include 'icons/time.svg' %} + {{ recipe.data.time }} +
+ {% endif %} +
+ +

{{ recipe.data.title }}

+
- -

{{ recipe.data.title }}

-
-
+ {% endif %} {% endfor %}