I have a menu (linklists.all-collections
) that contains a list of collections. The menu outputs the collection title, url and also any tags associated with the collection using collection.all_tags
.
The menu outputs fine, however the next time I call collection.title
on a collection template page it outputs the last collection title in the menu instead of the collection title of the current collection page.
Is there a way to close the loop (similar to how WordPress wp_reset_query()
destroys the previous query and sets up a new query)?
Menu is:
<ul>
{% for link in linklists.all-collections.links %}
{% assign collection = link.object %}
<li class="sidebar-menu-item {{ collection.handle }}">
<a href="{{ collection.url }}" title="{{ 'collections.general.link_title' | t: title: collection_title }}">{{ collection.title }}</a>
<ul>
{% for tag in collection.all_tags %}
{% unless tag == 'exclude' %}
<li>
<a href="{{ shop.url }}/collections/{{ collection.handle }}/{{ tag }}">{{ tag }}</a>
</li>
{% endunless %}
{% endfor %}
</ul>
</li>
{% endfor %}
</ul>