【问题标题】:How can I dynamically set SEO titles and descriptions for my Shopify products如何为我的 Shopify 产品动态设置 SEO 标题和描述
【发布时间】:2021-08-24 09:27:54
【问题描述】:

我想将我所有的产品标题设置为 {Product_titles |店铺名称}。我该如何设置? 我看到的问题是产品已经有一些手动放置的 SEO 标题,因为我们最近添加了很多产品,我们希望所有产品 SEO 标题和元描述的单一公式。 模板已经有这个标题的动态代码

<title>
      {{ page_title }}{% if current_tags %}{% assign meta_tags = current_tags | join: ', ' %} &ndash; {{ 'general.meta.tags' | t: tags: meta_tags }}{% endif %}{% if current_page != 1 %} &ndash; {{ 'general.meta.page' | t: page: current_page }}{% endif %}{% unless page_title contains shop.name %} &ndash; {{ shop.name }}{% endunless %}
    </title>

元描述

{%- if page_description -%}
      <meta name="description" content="{{ page_description | escape }}">

我想为产品、收藏、页面和博客文章保留不同类型的标题和元描述。

我可以在 shopify theme.liquid 中编辑它们吗?或者有任何应用可以帮助我们吗?

【问题讨论】:

    标签: shopify


    【解决方案1】:

    仅在产品页面上动态更改标题。

    在您的主题中找到您的 &lt;title&gt;&lt;/title&gt; 标签。

    在其中添加 {% if %} 语句。像这样:

    &lt;title&gt;{% if template == "product" %}Hey I'm a product page{% endif %}&lt;/title&gt;

    标题标签中可以有很多 if 语句。

    在您的情况下: &lt;title&gt;{% if template == "product" %}{{ product.title }} | {{ shop.name }}{% endif %}&lt;/title&gt;

    【讨论】:

      猜你喜欢
      • 2021-09-14
      • 2020-01-31
      • 1970-01-01
      • 1970-01-01
      • 2017-11-23
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多