How to hide link to empty collection not in main menu

Explorer
96 0 4

Hi there,

 

Long: Using Debut. I have  page with a link to a collection. I would like this link to be hidden when that collection is empty. How can I achieve this with liquid? (All answers here I have seen are about hiding links in the main navigation menu when the collection is empty...in my case, the link is on a page)

 

Short: I want to hide the bolded link when the collection it links to is empty (no products in it) . And, I want to show the link when the collection is not empty.

 

<div class="page-width">
  <div class="grid">
    <div class="grid__item medium-up--five-sixths medium-up--push-one-twelfth">
      <div class="section-header text-center">
        {% comment %}
        <h1>{{ page.title }}</h1>
        {% endcomment %}
      </div>

      <div class="rte">
        {{ page.content }}
      </div>
    </div>
    
    <a href="https://my-website/collections/emptycollectionexample"</a>
    
  </div>
</div>

Thanks for the help!

0 Likes
Highlighted
Explorer
96 0 4

Can I bump my own thread?

 

...Bump.

0 Likes