MD. Atiqur Rahman
MD. Atiqur Rahman

Reputation: 2173

Shopify if NOT homepage?

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.

Upvotes: 9

Views: 30215

Answers (3)

brenthack35
brenthack35

Reputation: 81

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 %}

Upvotes: 8

MD. Atiqur Rahman
MD. Atiqur Rahman

Reputation: 2173

Here is how we can do that:

{% if template.name != "index" %} 
 do something
{% endif %}

Upvotes: 33

Allsops
Allsops

Reputation: 133

I use it in this way:

    {% if template.name != "index" %}
      do something
    {% endif %}

Upvotes: 0

Related Questions