Our Partner & Developer boards on the community are moving to a brand new home: the .dev community forums! While you can still access past discussions here, for all your future app and storefront building questions, head over to the new forums.

Blogs standard URL filter /tagged/tag not working

Blogs standard URL filter /tagged/tag not working

hiba_abdelk
Shopify Partner
9 0 1

Current theme: Local 

I added the following code to create a filter for blogs

{%- for tag in blog.all_tags -%}
        <a
          class="button button--small {% if current_tags contains tag %} button--solid {% else %} button--outline {% endif %}"
          href="{{ blog.url }}/tagged/{{ tag | handleize }}"
        >
          {{ tag | capitalize }}
        </a>
{%- endfor -%}

I also tried {{ tag.handle }} instead of {{ tag | handleize }}

 

However blogs aren't filtered as intended, I searched for JavaScript code that could affect the filter's functionality but didn't find any

 

When I headed to navigation I saw this message "The current theme doesn’t support filters. " however after searching it should not affect the blogs filter it's only for the products filter and I ensured the URL format was working by trying the same URL on an old theme where the blogs got filtered correctly

 

Are there any other steps to take in order to debug this issue?

Replies 3 (3)

matthaigh
Shopify Partner
8 1 1

Is your article loop wrapped in a paginate object?

hiba_abdelk
Shopify Partner
9 0 1

Hello Matthaigh, I reverted to an older theme version and it fixed the issue but I'd still like to know how paginate can affect the filter of the article. Yes it was wrapped in paginate object

matthaigh
Shopify Partner
8 1 1

Hi Hiba

 

This was the snippet I used to get the tags to render in a list with links to add/remove.

 

I've had also specified which blog the tags are associated with "blogs.recipes.all_tags".

 

This snippet sits inside pagination.

 

<ul>
    {% for tag in  blogs.recipes.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>