如何在 Shopify 中从标题标签中移除店铺名称

· Updated
1 分钟阅读
如何在 Shopify 中从标题标签中移除店铺名称
目录

TL;DR

To remove your shop name from Shopify title tags, edit your theme code and delete the Liquid line that appends shop.name inside the title tag logic. This is usually found in layout/theme.liquid or a snippet like seo-title.liquid. It can make titles shorter and cleaner for SEO, but it may also reduce brand visibility, so test the impact in Google Search Console after making the change.

出于 搜索引擎优化(SEO)的原因,一些店主可能不希望在标题标签(title tag)中显示店铺名称。有些专家认为,店铺名称过长可能会对 SEO 产生负面影响,因为标题标签最好控制在约 60 个字符以内,才能在搜索结果中正常完整地显示。

你无法在“设置(Settings)”中直接完成这些更改。相反,你需要稍微调整一下代码。此方法同时适用于经典 Shopify 主题和 Online Store 2.0 主题。

下面我们来看看具体怎么做。

从标题标签中移除店铺名称

要从标题标签中移除店铺名称,你需要查看 theme.liquid 文件(位于 Layout 文件夹中),然后删除用于添加店铺名称的代码。例如,如果你的 theme.liquid 代码如下所示:

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

 

你可以将其改为下面的代码,以从标题标签中移除店铺名称。

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

  </title>

 

每个店铺和主题的代码都可能不同。关键在于找到那段把店铺名称添加到标题标签里的代码。大多数情况下,它看起来会像这样:

{% unless page_title contains shop.name %}

&ndash; {{ shop.name }}

{% endunless %}

 

从 theme.liquid 文件中移除这段代码后,你页面上的标题标签就不再显示店铺名称了。如果你仍然无法完成这一步,建议联系 Shopify 专家,他们会帮助你。

或者,你也可以在类似 这个 的社区讨论中发布你的 theme.liquid 代码,有编程知识的人会帮你找出需要移除的脚本。

结论

为 Shopify 店铺做 SEO 优化,有时意味着需要进行一些特定调整,例如从标题标签中移除店铺名称。标题标签里出现过长的店铺名称,可能会对 SEO 造成影响,因为搜索引擎建议标题标签控制在约 60 个字符以内,以便在搜索结果中获得最佳展示效果。

虽然你无法在 Shopify 设置中直接完成这项更改,但只需在 theme.liquid 文件中做一个简单的代码调整,就能实现想要的效果。此方法同时适用于经典主题以及更新的 Online Store 2.0 主题。

通过仔细编辑 theme.liquid 文件并移除将店铺名称插入标题标签的代码,你可以让页面标题更干净、更聚焦,从而有机会提升 SEO 排名。如果你在操作过程中遇到困难或需要进一步协助,建议联系 Shopify 专家,或到 Shopify 社区寻求帮助。

分享这篇文章

相关文章