Ad

How To Edit Content On Pages For Collection Tags In Shopify

- 1 answer

When creating Collections in Shopify I can easily add Tags to them, which are then displayed on the Collections pages (in most of the themes I've used so far). The Collections page will typically show all the Tags for any Product within that Collection.

If you click the Tag it will go to a new page. I'm trying to find a way to edit those pages - it does not appear that this ability is built into Shopify, so I'm looking for the best solution.

There are easily over a hundred tags on this site too. My hope is to avoid writing a ton of conditional statements, but I fear that may be my only option.

Liquid - Example of what I'm thinking:

{% if current_tags == 'tag-name' %}
  unique content for that tag
{% endif %}

Can anyone point me in a better direction?

Ad

Answer

The solution was simpler than I thought. I was using == when I should have been using 'contains'. Not that if your tags use spaces then you should type them exactly the same vs adding dashes to fill spaces.

Example:

{% if current_tags contains 'My Tag' %}
  <!-- Custom HTML goes here -->
{% endif %}
Ad
source: stackoverflow.com
Ad