Hide the collection from the listing in Dawn theme

I tried to hidden the collection named “Home” and “home 1” with the below coding at the main-list-collections

{%- for collection in collections -%}

{% if collection.handle != “Home” or collection.handle != “home 1” %}

<li class="collection-list__item grid__item{% if settings.animations_reveal_on_scroll %} scroll-trigger animate--slide-in{% endif %}"

{% if settings.animations_reveal_on_scroll %}
data-cascade
style=“–animation-order: {{ forloop.index }};”
{% endif %}

{% render ‘card-collection’,
card_collection: collection,
media_aspect_ratio: section.settings.image_ratio,
columns: 3
%}

{% endif %}

{%- endfor -%}

couple of mistakes:

  1. handle is the last part of your URL, so it’s can’t have spaces and it’s all lowercase.
    What you wanted to use is collection.title .
  2. You need to use and in your condition instead of or otherwise it will always be true (ok, collection title is “Home”, but it’s not “home 1” – show it)
{% if collection.title != "Home" and collection.title != "home 1" %}
 .. show collection
{% endif %}

Thanks a lot @tim_1

It works!!!

YEAH!!!

1 Like