List and select collection Tags and display them as link

Highlighted
New Member
15 0 0

Hello!

How is it possible to get all existing Tags within a collection and then filter out only the ones I want among them (e.g hardcoded in a list)? These Tags should then be presented as a Link that directs to the Tags page.

I ve seen some posts concerning that here, but they didnt work for me (Debut Theme). Thanks!

0 Likes
Shopify Partner
2522 25 538

Hi Nick, 

the basic code can be similar to this:

{% assign to_show = "tag1,tag 2,long tag" | split: "," %}
{% for tag in collection.all_tags %}
  {% if to_show contains tag %}
     {{ tag | link_to_tag: tag }}
  {% endif %}
{% endfor %}

 

Want to hire me to tweak a theme? Mail me at tairli@yahoo.com! My post solved your problem? This is my Paypal too :)
1 Like
New Member
15 0 0

Thx! That worked! ;-) 

0 Likes