Discuss and resolve questions on Liquid, JavaScript, themes, sales channels, and site speed enhancements.
hi all,
im using a code to add an image to my header. how can i exclude my homepage from this code? also how can i change the color of my font on my homepage header without it effecting all my other pages?
this is the code im using
.header {
background: url(https://cdn.shopify.com/s/files/1/0736/1419/7046/files/212Why_Choose_Us_Travel_Agency_6.png?v=169527...);
background-repeat: no-repeat;
background-position: center;
background-size: cover;
}
Hi @FWF
You can use this code in theme.liquid file to check page is homepage so you can apply code to homepage only or not apply code to homepage
{% if template == 'index' %}
{% endif %}
- Helpful? Like & Accept solution!
- Ryviu - Product Reviews & QA app: Collect customer reviews, import reviews from AliExpress, Amazon, Etsy, Walmart, Dhgate and CSV.
- Reton: Loyalty & Rewards - Earn points through tasks, redeem for discounts, and enjoy exclusive VIP rewards!
- Lookfy Gallery: Lookbook Image - Gain customers with photo gallery, video & shoppable image
- Reelfy‑Shoppable Videos+Reels: Create shoppable videos to engage customers and drive more sales.
- En...Sign up now.
what can i add in the middle of that code to say no or false or something?
{% if template == 'index' %}
// this is homepage
{% else %}
// this is not homepage
{% endif %}
- Helpful? Like & Accept solution!
- Ryviu - Product Reviews & QA app: Collect customer reviews, import reviews from AliExpress, Amazon, Etsy, Walmart, Dhgate and CSV.
- Reton: Loyalty & Rewards - Earn points through tasks, redeem for discounts, and enjoy exclusive VIP rewards!
- Lookfy Gallery: Lookbook Image - Gain customers with photo gallery, video & shoppable image
- Reelfy‑Shoppable Videos+Reels: Create shoppable videos to engage customers and drive more sales.
- En...Sign up now.
something like this
{% if header == 'index' %}
background:
false
{% endif %}
{% if template == 'index' %}
// this is homepage - you must add css code into style tags
<style>
</style>
{% else %}
// this is not homepage - you must add css code into style tags
<style>
</style>
{% endif %}
- Helpful? Like & Accept solution!
- Ryviu - Product Reviews & QA app: Collect customer reviews, import reviews from AliExpress, Amazon, Etsy, Walmart, Dhgate and CSV.
- Reton: Loyalty & Rewards - Earn points through tasks, redeem for discounts, and enjoy exclusive VIP rewards!
- Lookfy Gallery: Lookbook Image - Gain customers with photo gallery, video & shoppable image
- Reelfy‑Shoppable Videos+Reels: Create shoppable videos to engage customers and drive more sales.
- En...Sign up now.
Discover how to increase customer engagement on your store with articles from Shopify A...
By Jacqui Apr 23, 2025Hey 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, 2025