Reputation: 139
I want to display a description of "Test" collection's page.
If the url is mysite.com/collections/test
then it will show the description part.
But if the url have extra tags, example: mysite.com/collections/test/big
it won't show the description.
I tried with this code below but it didn't work:
{% if collection.description != blank %}
{% if collection.url == '/collections/test' %}
<div class="collection-description regular-content mb30">
{{ collection.description }}
</div>
{% endif %}
{% endif %}
Please help me with this. Thank you.
Upvotes: 0
Views: 1741
Reputation: 341
Just add an extra condition to the first if
, which will check if you have added any tags.
{% if collection.description != blank and current_tags == blank %}
<div class="collection-description regular-content mb30">
{{ collection.description }}
</div>
{% endif %}
The current_tags
object lists all tags used in product/articles filtering.
More info here: https://help.shopify.com/themes/liquid/objects/current-tags
Upvotes: 2