我怎样才能找到我所在的类别页面?
How can I find out what category page I am on?
我想在 products.html
上有一个 if 语句来检查您是否在类别页面上。例如 url 是 site.com/category/hoodies
,我想显示连帽衫类别的 "hero" 图片。
也许有分类页面的模板?
您可以访问多个 页面 变量,记录在此处:https://help.bigcartel.com/developers/themes/#variables-1
page.full_url
在这种情况下可以解决问题:
{% if page.full_url contains '/category/hoodies' %}
<img src="http://website.com/image.jpg">
{% endif %}
我想在 products.html
上有一个 if 语句来检查您是否在类别页面上。例如 url 是 site.com/category/hoodies
,我想显示连帽衫类别的 "hero" 图片。
也许有分类页面的模板?
您可以访问多个 页面 变量,记录在此处:https://help.bigcartel.com/developers/themes/#variables-1
page.full_url
在这种情况下可以解决问题:
{% if page.full_url contains '/category/hoodies' %}
<img src="http://website.com/image.jpg">
{% endif %}