Product tags are used to filter a collection so that only products with a given product tag are shown. In the same way, article tags filter a blog so that only articles with a given tag are shown. The current_tags variable is an array that contains all tags used to filter a collection or a blog.

The tags in current_tags are always in alphabetical order. You cannot change the order.

Inside collection.liquid

In collection.liquid, current_tags contains all product tags used to filter a collection.

The following example creates a list of every tag of the products in a collection. If the collection is filtered by a tag (current_tags contains the tag), the link removes the filter. If the collection is not filtered by the tag (current_tags does not contain the tag), a link to apply the filter is shown.

 <ul>

{% for tag in collection.all_tags %}
    {% if current_tags contains tag %}

  <li class="active">{{ tag | link_to_remove_tag: tag }}</li>
    {% else %}

  <li>{{ tag | link_to_add_tag: tag }}</li>
    {% endif %}
{% endfor %}

 </ul>

Inside blog.liquid

In blog.liquid, current_tags contains all article tags used to filter the blog.

The following example adds a breadcrumb that shows which article tag filters the blog. If the blog is filtered by a tag, the breadcrumb shows the tag name and links back to the unfiltered blog.

{% if current_tags %}
  <h1>{{ blog.title | link_to: blog.url }} » {{ current_tags.first }}</h1>
{% else %}
  <h1>{{ blog.title }}</h1>
{% endif %}