Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Shopify if NOT homepage?

Tags:

shopify

liquid

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.

like image 715
MD. Atiqur Rahman Avatar asked Jun 19 '18 07:06

MD. Atiqur Rahman


People also ask

How do I find my home page on Shopify?

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.

How do I change my Shopify homepage code?

From your Shopify admin, go to Online Store > Themes. Find the theme you want to edit, and then click Actions > Edit code.

How do I set a page as my homepage on Shopify?

Go to the Page Settings section and click the "Set as homepage" button. Did this answer your question?


2 Answers

Here is how we can do that:

{% if template.name != "index" %} 
 do something
{% endif %}
like image 168
MD. Atiqur Rahman Avatar answered Sep 21 '22 07:09

MD. Atiqur Rahman


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 %}
like image 31
brenthack35 Avatar answered Sep 24 '22 07:09

brenthack35