我已将以下html代码添加到我们的某个网站上的产品页面中:
<div itemtype="http://schema.org/Offer" itemscope="" itemprop="offers">
<div class="product-type-data">
<div itemtype="http://schema.org/Offer" itemscope="" itemprop="offers" class="price-box">
<span id="product-price-118" class="regular-price">
<span itemprop="price" class="price">30,00 €</span>
</span>
</div>
<p class="availability in-stock">Verfügbarkeit: <span>Auf Lager</span></p>
<meta content="http://schema.org/InStock" itemprop="availability">
<div class="clearfix"></div>
</div>
<meta content="EUR" itemprop="priceCurrency">
<meta content="30" itemprop="price">
我收到错误:“在网站管理员工具中测试时,结构化数据中的Google提供的属性优惠不适用于”提供类型的对象“(仅适用于具有类”价格框“的div)。
我还在这里附加了网站管理员的错误快照。 有人能够指出我在哪里出错的正确方向吗?
由于
答案 0 :(得分:0)
我知道这是一个古老的问题,但是我想回答,以防其他人需要答案。我还要假设报价是针对某种产品的(不是必需的,但对于大多数人来说可能很常见)。
首先,我想参考一些资源来阅读有关该主题的信息。
Google Structured Data Test Tool
我还想澄清这个问题与微数据有关,而不是与JSON-LD有关,所以我将以微数据格式进行答复。
我相信您的问题是您在“要约”中有一个“要约”。尝试以下代码:
<div itemprop="offers" itemscope itemtype="http://schema.org/Offer">
<div class="product-type-data">
<div class="price-box">
<span id="product-price-118" class="regular-price">
<span class="price">30,00 €</span>
</span>
</div>
<p class="availability in-stock">Verfügbarkeit: <span>Auf Lager</span></p>
<div class="clearfix"></div>
</div>
<meta content="http://schema.org/InStock" itemprop="availability">
<meta content="30" itemprop="price">
<meta content="EUR" itemprop="priceCurrency">
</div>
如果将上述代码放入Google测试工具中,它将进行验证。
如果您要使用其他示例,请转到上面的google产品参考链接,然后在示例部分(单个产品页面)中,选择微数据标签,然后选择“查看标记”。这将为您提供更完整的示例。如果Google删除了此代码,我将其包含在下面。
<div itemtype="http://schema.org/Product" itemscope>
<meta itemprop="mpn" content="925872" />
<meta itemprop="name" content="Executive Anvil" />
<link itemprop="image" href="https://example.com/photos/16x9/photo.jpg" />
<link itemprop="image" href="https://example.com/photos/4x3/photo.jpg" />
<link itemprop="image" href="https://example.com/photos/1x1/photo.jpg" />
<meta itemprop="description" content="Sleeker than ACME's Classic Anvil, the Executive Anvil is perfect for the business traveler looking for something to drop from a height." />
<div itemprop="offers" itemtype="http://schema.org/Offer" itemscope>
<link itemprop="url" href="https://example.com/anvil" />
<meta itemprop="availability" content="https://schema.org/InStock" />
<meta itemprop="priceCurrency" content="USD" />
<meta itemprop="itemCondition" content="https://schema.org/UsedCondition" />
<meta itemprop="price" content="119.99" />
<meta itemprop="priceValidUntil" content="2020-11-05" />
<div itemprop="seller" itemtype="http://schema.org/Organization" itemscope>
<meta itemprop="name" content="Executive Objects" />
</div>
</div>
<div itemprop="aggregateRating" itemtype="http://schema.org/AggregateRating" itemscope>
<meta itemprop="reviewCount" content="89" />
<meta itemprop="ratingValue" content="4.4" />
</div>
<div itemprop="review" itemtype="http://schema.org/Review" itemscope>
<div itemprop="author" itemtype="http://schema.org/Person" itemscope>
<meta itemprop="name" content="Fred Benson" />
</div>
<div itemprop="reviewRating" itemtype="http://schema.org/Rating" itemscope>
<meta itemprop="ratingValue" content="4" />
<meta itemprop="bestRating" content="5" />
</div>
</div>
<meta itemprop="sku" content="0446310786" />
<div itemprop="brand" itemtype="http://schema.org/Thing" itemscope>
<meta itemprop="name" content="ACME" />
</div>
</div>
答案 1 :(得分:-1)
您可以在https://schema.org/Product和商品https://schema.org/Offer找到产品类型的JSON + LD示例,但以下是一个示例:
<script type="application/ld+json">
{
"@context": "http://schema.org",
"@type": "Product",
"aggregateRating": {
"@type": "AggregateRating",
"bestRating": "100",
"ratingCount": "24",
"ratingValue": "87"
},
"image": "dell-30in-lcd.jpg",
"name": "Dell UltraSharp 30\" LCD Monitor",
"offers": {
"@type": "AggregateOffer",
"highPrice": "$1495",
"lowPrice": "$1250",
"offerCount": "8",
"offers": [
{
"@type": "Offer",
"url": "save-a-lot-monitors.com/dell-30.html"
},
{
"@type": "Offer",
"url": "jondoe-gadgets.com/dell-30.html"
}
]
}
}
</script>