CMS Development

JLanfear
Member

Hiding blog tags

SOLVE

Hi,

 

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.

 

JLanfear_0-1617707507225.png

 

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 %}

 

Any help would be appreciated thank you!

0 Upvotes
1 Accepted solution
Kevin-C
Solution
Recognized Expert | Partner
Recognized Expert | Partner

Hiding blog tags

SOLVE

Hey @JLanfear 

 

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 %}

 

 

Hope this gets you moving!

Kevin Cornett - Sr. Solutions Architect @ BridgeRev

View solution in original post

2 Replies 2
Kevin-C
Solution
Recognized Expert | Partner
Recognized Expert | Partner

Hiding blog tags

SOLVE

Hey @JLanfear 

 

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 %}

 

 

Hope this gets you moving!

Kevin Cornett - Sr. Solutions Architect @ BridgeRev
JLanfear
Member

Hiding blog tags

SOLVE

Worked a treat, thanks buddy! Appreciate the help.