我有一个问题:Google的结构化数据测试工具给了我一个错误:
标签
position
不存在。这是必需的。
我将它添加到标记中。比我得到这个错误:
Position
属性对Product
类型的对象无效
这是我的标记:
<table id="sale_table" itemscope="" itemtype="http://schema.org/ItemList">
<tbody>
<tr itemprop="itemListElement" itemscope="" itemtype="http://schema.org/Product">
<td class="sale_art_td" itemprop="productID">10496278</td>
<td class="sale_brand_td" itemprop="brand"><span itemprop="name ">--</span></td>
<td class="sale_name_td" itemprop="name">10496278 / Крышка трамблера Daewoo Nexia,Espero DD</td>
<td class="sale_am_td">1.00</td>
<td class="sale_price_td" itemprop="offers" itemscope="" itemtype="http://schema.org/Offer"><meta itemprop="priceCurrency" content="RUR"><span itemprop="price">341.50</span></td>
<td class="sale_buy_td"><a href="javascript:void(0);" class="sale_buy_link" data-id="63455914" data-query="10496278">Купить</a><!--<img src="/upload/badge/sale_cart.png" />--></td>
<td class="hidden">
<meta itemprop="url" content="/partsearch/?q=10496278">
<span itemprop="description">Распродажа: 10496278 / Крышка трамблера Daewoo Nexia,Espero DD по цене 341.50</span>
</td>
</tr>
<tr itemprop="itemListElement" itemscope="" itemtype="http://schema.org/Product">
<td class="sale_art_td" itemprop="productID">76202sx0a12</td>
<td class="sale_brand_td" itemprop="brand"><span itemprop="name ">HONDA</span></td>
<td class="sale_name_td" itemprop="name">76202SX0A12</td>
<td class="sale_am_td">1.00</td>
<td class="sale_price_td" itemprop="offers" itemscope="" itemtype="http://schema.org/Offer"><meta itemprop="priceCurrency" content="RUR"><span itemprop="price">704.00</span></td>
<td class="sale_buy_td"><a href="javascript:void(0);" class="sale_buy_link" data-id="63456060" data-query="76202sx0a12">Купить</a><!--<img src="/upload/badge/sale_cart.png" />--></td>
<td class="hidden">
<meta itemprop="url" content="/partsearch/?q=76202sx0a12">
<span itemprop="description">Распродажа: 76202SX0A12 по цене 704.00</span>
</td>
</tr>
</tbody>
</table>
这不是您的代码的错误。这只是意味着除非您提供此属性,否则Google不会显示某个Rich Snippet(或类似功能)。
然而,position
property没有为Product
type定义,所以这没有任何意义。
这似乎是Google新的结构化数据功能,尚未记录,因为它链接到404页面:List Page Carousels。也许这是一项正在进行中的工作,他们并不打算在他们的测试工具中发布支票。
所以我现在暂时忽略这一点。
我想这是由非显式文档引起的Google方面的实施错误:
https://schema.org/itemListElement明确指出
现有实体最适合数据中现有事物的简单无序列表。当您想要提供有关该列表中元素的其他上下文或同一项可能位于不同列表中的不同位置时,ListItem与有序列表一起使用。
注意:标记中元素的顺序不足以指示订单或元素。在这种情况下,使用带有'position'属性的ListItem。
与此同时,预计值将是以下类型之一:
=>这意味着隐含地,只有排序列表才需要position元素,而排序列表又要求Thing元素包含在ListItem元素中,该元素提供itemprop位置。
它还隐含地表示如果ItemListElement是Text或Thing,则该列表应被视为Unordered。
这是文档有意义的唯一方法。我认为错过了隐式连接。
因此,我认为适当的操作是为结构化数据测试工具提交错误报告,并暂时使用警告或将产品嵌套在ListItem元素中作为变通方法。
从我的测试中,malefique是正确的解决方案。
此代码使用Structured Data testing tool完全验证:
{
"@context": "http://schema.org",
"@type": "ItemList",
"itemListOrder": "http://schema.org/ItemListOrderDescending",
"itemListElement": [
{
"@type": "ListItem",
"position": 1,
"item": {
"@type": "Product",
"name": "My product",
"url": "www.example.com",
"offers": {
"@type": "Offer",
"availability": "http://schema.org/InStock",
"price": "100.00",
"priceCurrency": "AUD"
}
}
}
]
}
试试这个
'@type': 'ListItem',
'position': 1,
'item':{
'@type': 'Product',
... product props
}
我找到了http://schema.org/itemListElement
你必须指定像<meta itemprop="position" content="1" />
这样的位置
页面底部有一个示例。
解决方法是将你的product
填充到ListItem
的item
财产中。 ListItem
获得position
财产。一旦你这样做,它就通过谷歌的SDTT。
注意:在多个URL / URI上使用产品offer
无效。
为每个产品报价构建一个页面(唯一的URL),这是您放置结构化数据/ schema.org产品报价数据的位置;或者,将您的所有产品优惠放在一个页面(URL / URI)上 - 绝不是两者兼而有之。否则,你会得到错误All values provided for url must point to the same page.