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 ❤️
Hey Community 👋 Did you know that March 15th is National Everything You Think Is W...
By JasonH Apr 1, 2025Discover how to increase the efficiency of commerce operations with Shopify Academy's l...
By Jacqui Mar 26, 2025Shopify and our financial partners regularly review and update verification requiremen...
By Jacqui Mar 14, 2025