Shopify show collection 条件描述

Shopify show collection description on conditions

我想显示 "Test" collection 页面的描述。

如果url是mysite.com/collections/test那么它会显示描述部分。

但是如果 url 有额外的标签,例如:mysite.com/collections/test/big 它不会显示描述。

我尝试使用下面的代码,但没有用:

{% if collection.description != blank %}
    {% if collection.url == '/collections/test' %}
    <div class="collection-description regular-content mb30">
      {{ collection.description }}
    </div>
      {% endif %}
      {% endif %}

请帮我解决这个问题。谢谢。

只需在第一个 if 中添加一个额外的条件,它将检查您是否添加了任何标签。

{% if collection.description != blank and current_tags == blank %}
    <div class="collection-description regular-content mb30">
        {{ collection.description }}
    </div>
{% endif %}

current_tags 对象列出了在 product/articles 过滤中使用的所有标签。

更多信息在这里:https://help.shopify.com/themes/liquid/objects/current-tags