Shopify 如果不是主页?

Shopify if NOT homepage?

如何检测 shopify if Homepage?以前有一个处理程序 page.frontpage 不再使用了。

我需要从主页中排除一些东西,所以我不能去编辑 index.liquid 文件。

我们可以这样做:

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

我是这样使用的:

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

要检测主页,您应该使用双等号“==”,使用感叹号“!=”可以找到 "not" 等于 "index" 的所有内容。

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