元数据
您可以使用 HTML 和 Liquid 在 theme 中包含搜索引擎优化(SEO)metadata。主要需要考虑三个方面:
上述 SEO metadata 代码应包含在 <head> 元素中。
例如:
<head>
<title>{{ page_title | default: shop.name }}</title>
<meta name="description" content="{{ page_description | default: shop.name | escape | truncatebytes: 320, "" }}">
<link rel="canonical" href="{{ canonical_url }}">
</head>
Title tag
您可以包含一个 <title> 元素,供搜索引擎读取页面标题。大多数页面的标题可以在管理后台中设置,您可以通过 Liquid page_title object 访问该标题。
Meta description
您可以包含一个 <meta> 元素,供搜索引擎读取页面描述。大多数页面的描述可以在管理后台中设置,您可以通过 Liquid page_description object 访问该描述。
Canonical URL
您可以使用全局 Liquid canonical_url object 为指定页面设置 canonical URL。