动态更改Big Cartel上的元页面标题 [英] Change meta page titles on Big Cartel dynamically

查看:106
本文介绍了动态更改Big Cartel上的元页面标题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Big Cartel中有一个自定义主题,我需要使用BC自己的标签创建一个if语句,该语句查看页面URL,然后显示一个标签.

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.

例如,如果url是主页,则显示此标签,如果是产品页面a,则显示此标签,依此类推...

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>

推荐答案

您可以使用许多不同的条件,例如检查页面名称,页面永久链接,完整URL或其他.此处提供完整的变量参考: http://help.bigcartel.com/customer/portal/articles/772750-variables#page

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

这是几个例子:

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

{% if page.permalink == 'home' %}
  code here
{% elsif page.permalink == 'product' %}
  more code here
{% endif %}

这篇关于动态更改Big Cartel上的元页面标题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆