I have created a module that displays the three most recent posts on my homepage, however, I have also created a Post banner that displays posts with the tag 'featured' on my homepage.
Basically in the three latest posts (See below) I display the tag of the recent post above the title. I am wanting to display the relevant tag but not display the featured tag.
Currently, to display the tags above the title I am using
{% for tag in post.tag_list %} <a class ="latest-post__blog-tags--tags">{{ tag.name }}</a> {% endfor %}
You can check the value of the tag.name and conditionally print the tag if it's not "featured":
{% for tag in post.tag_list %}
{% if tag.name|lower != 'featured' %}
<a class ="latest-post__blog-tags--tags">{{ tag.name }}</a>
{% endif %}
{% endfor %}
Apr 14, 202510:27 AM - edited Apr 14, 202510:29 AM
Participant
Hiding blog tags
SOLVE
Hi @Kevin-C I did the same, thanks for the tip. But now I have five webpages that need a curated set of three blogs as related blog posts. I would love to have a module where you could choose the blog names to include, but in leu of that, I am using tags and omitting these tags in the blog detail template.
So, how do I compound the tags to omit when listing tags to check for?
I have tried this: {% if tag.name|lower != 'featured' or tag.name|lower != 'pre-trade' or tag.name|lower != 'data-services' %}
And this: {% if (tag.name|lower != 'featured') or (tag.name|lower != 'pre-trade') or (tag.name|lower != 'data-services') %}
You can check the value of the tag.name and conditionally print the tag if it's not "featured":
{% for tag in post.tag_list %}
{% if tag.name|lower != 'featured' %}
<a class ="latest-post__blog-tags--tags">{{ tag.name }}</a>
{% endif %}
{% endfor %}
Sorry to possibly re-post, but this is the first time using the community, so not sure you get notified if I don't reply to you. Can you take a look at my question above that build on this issue? Thanks, Racine