How to edit content on pages for Collection Tags in Shopify

爷,独闯天下 提交于 2019-12-25 08:17:25

问题


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?


回答1:


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 %}


来源:https://stackoverflow.com/questions/40269045/how-to-edit-content-on-pages-for-collection-tags-in-shopify

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!