Discuss and resolve questions on Liquid, JavaScript, themes, sales channels, and site speed enhancements.
Hello everyone ! I have a piece of HTML code. I want to attach it to the header of the homepage. Home page only. I found the header.liquid file but it seems to show up on the whole website. Can someone help me with this problem?
Thanks everyone!
Hello @NQuan088
You can add code to the header.liquid like this
{% if template contains 'index' %}
//Your code here
{% endif %}
I hope the above is useful to you.
Kind & Best regards,
GemPages Support Team
You can be in the [edit code => layout=> theme.liquid] add
{% if template.name == "index" %}
//your code here....
{%endif%}
I did it. Thank you very much ❤️
Shopify and our financial partners regularly review and update verification requiremen...
By Jacqui Mar 14, 2025Unlock the potential of marketing on your business growth with Shopify Academy's late...
By Shopify Mar 12, 2025Learn how to increase conversion rates in every stage of the customer journey by enroll...
By Shopify Mar 5, 2025