Display Link List of Tags for All Collections on Every Page of Site?

New Member
11 0 0

I've been digging through the forums and can't find an answer. I need to be able to create a link list of product tag URLs for ALL collections on EVERY page of the site.

I'm using this snippet:

{% for tag in collection.tags %}
<li>{{ tag | linktotag: tag }}</li>
{% endfor %}

It works the way I need it to on the main collections page:

/collections/all/TAGNAME/

But as you navigate to collection pages or product pages -- this snippet only shows the product tags associated with the collection or product being viewed:

/collections/COLLECTIONNAME/TAGNAME/

- or -

/collections/all/products/PRODUCTNAME?constraint=TAGNAME

Is there a way to get around this and always use all collections in the tag link list -- no matter what page is being viewed? Thank you so much for your help.

0 Likes
Shopify Partner
58 0 9

{% for tag in collections.tags %} <li>{{ tag | linktotag: tag }}</li> {% endfor %}

I think it is just your plurals, try this.

0 Likes
New Member
11 0 0

Comes up blank now.

0 Likes
New Member
11 0 0

Anyone have any thoughts here?

0 Likes
New Member
11 0 0

Anybody?

0 Likes
New Member
11 0 0

Bueller?

0 Likes
Shopify Expert
9807 92 1560

The important thing to note here is that the maximum number of tags returned will be 1000. If you've been heavy on the tag use you'll need to look at other options - perhaps app based solutions.

If you have created a collection with the handle of 'all' that contains all products you could do something like this:

{% assign collectionAllTags = collections.all.tags %}
{% for tag in collectionAllTags %}
  <li><a href="/collections/all/{{ tag }}">{{ tag }}</a></li>
{% endfor %}

 

 

★ Winning Partner of the Build a Business competition. ★ http://freakdesign.com.au
0 Likes
New Member
11 0 0

Thanks, Jason. This is close. The {{ tag }} needs to be a URL title in the <a> link. I tried a couple of filters with no success. Is there a solution?

0 Likes
New Member
11 0 0

Anyone have any recommendations at this point? This is what Jason had me use:

{% assign collectionAllTags = collections.all.tags %}
{% for tag in collectionAllTags %}
	<li><a href="/collections/all/{{ tag }}">{{ tag }}</a></li>
{% endfor %}

It's close. The names are correct. I just need the link URL to display correctly. Thank you for your help.

0 Likes
New Member
11 0 0

Currently, the links look like:

<li><a href="/collections/all/Collection Name Goes Here">Collection Name Goes Here</a></li>

But need to look like:

<li><a href="/collections/all/collection-name-goes-here">Collection Name Goes Here</a></li>

Any help would be appreciated. Thanks.

0 Likes