How to hide the product name on the homepage without losing the link

I want to remove the product name from under my product images on my homepage. Right now it looks like this:

I want it to look like this:

I figured out how to it with this code pasted at the bottom of the template-collection.css file:

.collection .card__heading {
    display: none !important;
}

However, the problem is that when I use this code, I lose the link on the images. You can’t click on them any longer to get to the product page.

I need code that will hide the product name on the homepage (only), but still leave the link in place on the image.

My storefront is https://worthy.la/

Any help? Thanks!

Hi @donloper

I would like to give you a recommendation to support you.

You can change your code to

.collection .card__heading {
    opacity: 0 !important;
}

The above code only hides the product name.

Best regards,
GemPages Support Team

1 Like

Hi [email removed]Donloper,

You can try this code by following these steps:

Step 1: Go to Online Store->Theme->Edit code.

Step 2: Search file theme.liquid,

Step 3: Paste the below code at before element of the file → Save

{% if template.name="index" %}

{% endif %}

Hope my solution works perfectly for you!

Best regards,

Victor | PageFly

Thank you!!!

Hi Victor, I tried the suggestion above by GemPages and it worked, so I haven’t tried your solution yet, but I’m wondering if there’s any reason your solution may be better than the other one. I know that sometimes something gets fixed but then creates other problems in other places, and I haven’t had time to test everything yet but am curious if you would say one way is better than the other. Thanks!

Hello @donloper ,
you can see when using way of GemPages it will have white spacing

if use my way it will not have white spacing

I agree, that’s a better solution, but I’ve tried putting that code in a bunch of places in the theme.liquid file, but nothing happens. There is no /header, so I put it before the /head tag, and in a bunch of other places, but nothing.

Hi @donloper ,
sorry I miss

{% if template.name=="index" %}

{% endif %}

Hi Victor, I’m still not sure where to put this. I put it in the theme.liquid file before /head, before /script, but nothing happens.

Hi @donloper ,
you are set side in
you should set it out outside


{% if template.name=="index" %}

{% endif %}

I’ve tried that, but that doesn’t work either. Right now it’s like this but same results.

Hi @donloper ,
You can add again

{% if template.name == "index" or template == "index" or request.page_type == "index" %}

{% endif %}
1 Like

That worked! Thank you!

That great. I’m glad when I can help you :heart_eyes: