Change meta page titles on Big Cartel dynamically

2019-09-02 10:16发布

I have a custom theme in Big Cartel and I need to create an if statement using BC's own tags that looks at the page URL and then displays a tag.

For example, if url is homepage show this tag, if it is product page a, show this tag and so on...

Anyone have any idea how I can write that?

At the moment the theme has this:

<title>{{ page.name | remove: '-footer-' | remove: '-hide-' | remove: '-sidebar-' | remove: '-subnav-' | remove: '-f1-' | remove: '-f2-' | remove: '-f3-' }} | {{ store.name }}</title>

1条回答
再贱就再见
2楼-- · 2019-09-02 10:35

There are a number of different conditions you could use for this, like checking the page name, page permalink, the full URL, or others. A full variable reference is available here: http://help.bigcartel.com/customer/portal/articles/772750-variables#page

Here's a couple examples:

{% if page.name == 'Home' %}code here {% endif %}

{% if page.permalink == 'home' %}
  code here
{% elsif page.permalink == 'product' %}
  more code here
{% endif %}
查看更多
登录 后发表回答