JustinWDev of Archived Theme Support
10/29/2015 - 5:21 PM

Add blog tag filter to the top of blog page in #Brooklyn theme.

Add blog tag filter to the top of blog page in #Brooklyn theme.

What you want:

How to get there:

In blog.liquid add the code below just after the </h1> that shows the blog title.

      {% if blog.all_tags.size > 0 %}
        <ul class="tags tags--collection inline-list">
          <li{% unless current_tags %} class="tag--active"{% endunless %}>
            <a href="/blogs/{{ blog.handle }}">
              {{ 'collections.general.all_of_collection' | t }}
            </a>          
          </li>
          {% for tag in blog.all_tags %}
            {% if current_tags contains tag %}
              <li class="tag--active">
                {{ tag | link_to_remove_tag: tag }}
              </li>
            {% else %}
              <li>
                {% comment %}
                Use link_to_add_tag if you want to allow filtering
                by multiple tags
                {% endcomment %}
                {{ tag | link_to_tag: tag }}
              </li>
            {% endif %}
          {% endfor %}
        </ul>
      {% endif %}