Change meta page titles on Big Cartel dynamically

只愿长相守 提交于 2019-12-25 02:19:23

问题


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:


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


来源:https://stackoverflow.com/questions/23842539/change-meta-page-titles-on-big-cartel-dynamically

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!