添加了结构化数据的效果:
在搜索结果中更可能显示红框里的内容,可以提高点击。点击次数是排名的重要影响因素。
未添加结构化数据的效果:
shopify主题一般会自带部分结构化数据,叫做微结构化数据。所以用富媒体检测工具https://search.google.com/test/rich-results 时,会看到有些已经标记了,有些还没有标记。
shopify网站适合添加的结构化数据类型:
用JSON-LD。
首页适合添加:Organization
Organization官方文档:https://schema.org/Organization 可以找到JSON-LD,复制再修改。
目录页适合添加:Collection
Collection官方文档:https://schema.org/Collection 可以找到JSON-LD,复制再修改。
产品页适合添加:BreadcrumbList,Product
BreadcrumbList官方文档:https://schema.org/BreadcrumbList ,找到JSON-LD,复制再修改。
Product官方文档:https://schema.org/Product ,找到JSON-LD,复制再修改。
新闻报道、指南或博客适合添加:Article
Article官方文档:https://schema.org/Article, 找到JSON-LD,复制再修改。
一些细节问题可以看:https://support.google.com/webmasters/topic/2774098 特别注意几个地方:
ratingValue - 指网页上显示的平均评分。
bestRating
- 评分系统中的最高值。例如,如果评分量表为一颗星到五颗星,那么将 5 指定为最高评分。
ratingCount - 指有多少个评论。
一些常见的结构化数据,可以分网站类型添加:https://developers.google.com/search/docs/advanced/structured-data/article 可以分别到官网https://schema.org/上找文档。
上面讲了shopify可以添加的结构数据,具体怎样添加?
可以用插件:Schema App Total Schema Markup - Product Rich Snippets to Stand Out in Search with a... | Shopify App Store最低每月15美元。
但是在使用之前,需要先把主题自带的微结构数据标记去掉:
打开一个名为“微数据过滤已启用”的设置。 这将告诉 SchemaApp 删除由 Shopify 主题生成的任何架构。
添加好了之后,可以用https://search.google.com/test/rich-results 检测,可以看到实际展示效果。但是谷歌抓取需要时间,添加之后不会立即有效。并且即使添加成功了,也不是每一次展示时都展示出效果。
自己手动怎样添加?
创建 Snippet,并命名为:
shopify-json-ld.liquid
粘贴以下代码:
{% capture jsonld_for_seo_protocol %}{
{ canonical_url | split: '://' | first | default: 'https'}}://{% endcapture %}
{% capture jsonld_root_url %}{
{ jsonld_for_seo_protocol }}{
{ shop.domain }}/{% endcapture %}
{%- assign jsonld_logo = 'logo.png' | asset_img_url | prepend: "https:" -%}
{% if template == 'index' %}
<script type="application/ld+json">
{
"@context": "{
{ jsonld_for_seo_protocol }}schema.org",
"@type": "WebSite",
"@id": {
{ jsonld_root_url | append: "#website" | json }},
"url": "{
{ jsonld_for_seo_protocol }}{
{ shop.domain }}",
"potentialAction": {
"@type": "SearchAction",
"target": "{
{ jsonld_for_seo_protocol }}{
{ shop.domain }}/search?q={query}",
"query-input": "required name=query"
}
}
</script>
{% endif %}
{%- assign jsonld_business_type = 'Organization' -%}
<script type="application/ld+json">
{
"@context": "{
{ jsonld_for_seo_protocol }}schema.org",
"@type": {
{ jsonld_business_type | json }},
"@id": {
{ jsonld_root_url | append: "#org" | json }},
"name": {
{ shop.name | json }},
"url": "{
{ jsonld_for_seo_protocol }}{
{ shop.domain }}",
"description": {
{ shop.description | json }},{% unless shop.phone == blank %}
"telephone": {
{ shop.phone | json }},{% endunless %}
"logo": {
{ jsonld_logo | json }},
"image": {
{ jsonld_logo | json }},
"sameAs": {
{ '' | split: ',' | json }},
"address": {
"@type": "PostalAddress",
"streetAddress": {
{ shop.address.street | json }},
"addressLocality": {
{ shop.address.city | json }},
"addressRegion": {
{ shop.address.province | json }},
"postalCode": {
{ shop.address.zip | json }},
"addressCountry": {
{ shop.address.country | json }}
}
}
</script>
{%- if template contains 'product' -%}
{%- assign jsonld_for_seo_show_product_on_page = true -%}
{%- assign jsonld_for_seo_product = product -%}
{%- assign jsonld_for_seo_object = product -%}
{%- endif -%}
{%- liquid
if jsonld_for_seo_show_product_on_page and jsonld_for_seo_product != blank
assign jsonld_for_seo_variant_has_price = false
for variant in jsonld_for_seo_product.variants
if variant.price != 0
assign jsonld_for_seo_variant_has_price = true
break
endif
endfor
if jsonld_for_seo_variant_has_price == false
assign jsonld_for_seo_show_product_on_page = false
endif
endif
-%}
{%- if jsonld_for_seo_show_product_on_page and jsonld_for_seo_product != blank -%}
{%- assign jsonld_product_tags = jsonld_for_seo_product.tags -%}
{%- assign jsonld_heritage = jsonld_for_seo_product.metafields.general.heritage | downcase -%}
{%- if jsonld_heritage == 'vintage' -%}{%- assign jsonld_condition_from_heritage = 'UsedCondition' -%}{%- endif -%}
{%- assign item_condition = jsonld_for_seo_product.metafields.jsonld.itemCondition | default: jsonld_condition_from_tag | default: jsonld_condition_from_heritage | default: "NewCondition" -%}
{%- assign jsonld_availability = jsonld_for_seo_product.metafields.jsonld.availability -%}
{%- assign jsonld_product_id = canonical_url | append: '#json-ld-for-seo' -%}
<script type="application/ld+json">
{
"@context": "{
{ jsonld_for_seo_protocol }}schema.org",
"@id": {
{ jsonld_product_id | json }},
"@type": "Product",{% unless shop.metafields.jsonld.hide_vendor == "true" %}
"brand": {
"@type": "Brand",
"name": {
{ jsonld_for_seo_product.metafields.jsonld.vendor | default: shop.metafields.jsonld.vendor | default: jsonld_for_seo_product.vendor | json }}
},{% endunless %}
"productID": {
{jsonld_for_seo_product.selected_or_first_available_variant.barcode | json }},
{%- if shop.metafields.jsonld.sku_for_mpn == "true" -%}
{%- assign jsonld_mpn = jsonld_for_seo_product.metafields.jsonld.mpn | default: jsonld_for_seo_product.selected_or_first_available_variant.sku | default: jsonld_for_seo_product.selected_or_first_available_variant.barcode -%}
{%- else -%}
{%- assign jsonld_mpn = jsonld_for_seo_product.metafields.jsonld.mpn | default: jsonld_for_seo_product.selected_or_first_available_variant.barcode | default: jsonld_for_seo_product.selected_or_first_available_variant.sku -%}
{%- endif -%}
"sku": {
{ jsonld_for_seo_product.selected_or_first_available_variant.sku | json }},
"mpn": {
{ jsonld_mpn | json }},
"gtin": "{
{jsonld_for_seo_product.selected_or_first_available_variant.barcode}}",
{%- if jsonld_for_seo_product.selected_or_first_availa