Show/Hide Overlay Text On Collection pages if there is an image present - Debut Theme

Hi i would like to be able to check if there is an image for the collection and if there is then show the image on collection pages and hide the overlay text. Any ideas how this can be achieved.

the image below has the overlay. Because there is an image i don’t need to have the text overlay in this case. but when there is no image for the said collecto then it should show the overlay/title.


        
          # 
              {{ 'collections.general.collection_label' | t }}: 
              {{ collection.title }}
          
        

HI community, This code is from collection-template.liquid. If would like to hide {{collection.title}} if there is a background image present. If there is no background image then i would like to show it. Can this be done with an if statement?

thanks

RJ

I tried this code and it worked. Is there anything wrong with doing it this way? Would it have any sort of negative impact on performance etc.


        
          # 
              {{ 'collections.general.collection_label' | t }}: 
            {%  unless collection.image %}
              {{ collection.title }}
            {% endunless %} 
          
        

Have you noticed any negatives? I have this exact same question and can’t find a solution anywhere!

Hi shirley,

It works fine for me and i have not found any issue.

thanks

RJ