CMS Development

gianpi
Mitglied

Customize tag filter module

Hello, I'm here to ask some help as I'm trying to customize the filter module I use in my blog to group together the contents by tag (this is the listing page https://blog.osservatori.net/it_it where tag list is under the "Categorie" box). My purpose is to put a specif tag ("News") at the top of the list, but so far I can just order these values by name or by post counter. Does any of you have an idea in which way I could make it?

Thanks in advance

Gianpiero

0 Upvotes
1 Antwort
Stephanie-OG
Autorität

Customize tag filter module

If you'd just like one specific tag at the top, you can create a custom module that displays the News topic first and then uses post_tags to show all tags except the News tag afterwards, something like this:

 

{% set my_tags = blog_tags('default', 250) %}
<ul>
  <li><a href="https://blog.osservatori.net/it_it/tag/news">News</a></li>
  {% for item in my_tags %}
  {% if item != "News" %}
  <li><a href="{{ blog_tag_url(group.id, item.slug) }}">{{ item }}</a></li>
  {% endif %}
  {% endfor %}
</ul>

 

The only issue with using HubL for blog tags is that there's no easy way to show the post count. I believe there are some workarounds in the Community but I've struggled to get them working in the past.  

 


Stephanie O'Gay Garcia

HubSpot CMS Design & Development

Website | Contact

 

If this helped, please mark it as the solution to your question, thanks!