Only allow specific Tags to show on Collections Pages (Debut Theme)

Hey team,

I tried following this forum and try to replicate the same on Debut theme but it’s not working. Basically i would like to have a prefix like filter_ for the new tags that I want to display on the frontend and not have any other tags display.

I am not sure where I went wrong as I can still see tags with filter_

{% assign exclude_tags = "amazon,airbed,air mattress,backcountry,backpack,backpacking,bags,basecamp,base camp,beer growler,beer tumbler,bluetooth speaker,cali,camping chair,camping furniture,camping gear,camping cookware,camp accessories,camp chair,camp cooking,camp furniture, camp table" %}
                        {% for tag in collection.all_tags %}
                          {% if exclude_tags contains tag %}
    {% continue %}
  {% endif %}

                        
                        {% if tag contains 'filter_' %}
          {% assign tagName = tag | remove: 'filter_' %} 
                           {% if current_tags contains tag %}
              - {{ tagName | link_to_remove_tag: tag }}
              

            {% else %}
              - {% comment %}
                    Use link_to_add_tag if you want to allow filtering
                    by multiple tags
                  {% endcomment %}
                  {{ tagName | link_to_tag: tag }}
              

            {% endif %} 
         {% endif %}
      
                        
                        {% assign prefix = tag | slice: 0 %}
      {% if prefix == '_' %}
        {% continue %}
      {% endif %}
                        
                          
                        {% endfor %}

Hi @ctsimon ,

Please change the code:

{% assign exclude_tags = "amazon,airbed,air mattress,backcountry,backpack,backpacking,bags,basecamp,base camp,beer growler,beer tumbler,bluetooth speaker,cali,camping chair,camping furniture,camping gear,camping cookware,camp accessories,camp chair,camp cooking,camp furniture, camp table" %}
{% for tag in collection.all_tags %}
  {% if exclude_tags contains tag %}
    {% continue %}
  {% endif %}

  {% if tag contains 'filter_' %}
    {% assign tagName = tag | remove: 'filter_' %} 
    {% if current_tags contains tag %}
      
    {% else %}
      
    {% endif %} 
  {% endif %}

  {% assign prefix = tag | slice: 0 %}
  {% if prefix == '_' %}
    {% continue %}
  {% endif %}
  
{% endfor %}

Hope it helps!

Hi @ctsimon ,

Please change the code:

{% assign exclude_tags = "amazon,airbed,air mattress,backcountry,backpack,backpacking,bags,basecamp,base camp,beer growler,beer tumbler,bluetooth speaker,cali,camping chair,camping furniture,camping gear,camping cookware,camp accessories,camp chair,camp cooking,camp furniture, camp table" %}
{% for tag in collection.all_tags %}
  {% if exclude_tags contains tag %}
    {% continue %}
  {% endif %}

  {% if tag contains 'filter_' %}
    {% assign tagName = tag | remove: 'filter_' %} 
    {% if current_tags contains tag %}
      
    {% else %}
      
    {% endif %} 
  {% endif %}

  {% assign prefix = tag | slice: 0 %}
  {% if prefix == '_' %}
    {% continue %}
  {% endif %}
  
{% endfor %}

Hope it helps!