How do I detect shopify if Homepage
? Previously there was a handler which was page.frontpage
which is not used anymore.
I need to exclude something from the homepage, so I can't go for editing the index.liquid
file.
To detect the homepage you should use double equals "==" the use of the exclamation "!= " is finding everything "not" equal to "index". Show activity on this post.
From your Shopify admin, go to Online Store > Themes. Find the theme you want to edit, and then click Actions > Edit code.
Go to the Page Settings section and click the "Set as homepage" button. Did this answer your question?
Here is how we can do that:
{% if template.name != "index" %}
do something
{% endif %}
To detect the homepage you should use double equals "==" the use of the exclamation "!=" is finding everything "not" equal to "index".
{% if template.name == "index" %}
do something
{% endif %}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With