Filter collections by tag and display tag-based collection content

Hi All. We would like to filter Collection by a specific Tag and show the Collection Headlines. It is important to us to show only one Collection with a specific Tag which we display in Navigation. My code is following:

{% assign show_tags = “sunglasses” | split: “,” %}> > {% for collection in collections %}> {% unless show_tags contains tag %}> {% continue %}> {% endunless %}> >
{{ collection.title }}

{% endfor %}

unfortunately the code does not work. Collection.title wont be shown, nothing will be shown even though a collection with that tag exists. Does anyone know what goes wrong here? Thank you

Hi @michalc524 ,

Please change code:

{% assign show_tags = "sunglasses" | split: "," %}

{% for collection in collections %}
  {% if collection.tags contains show_tags %}
    
      
{{ collection.title }}

    

  {% endif %}
{% endfor %}

Hope it helps!