使用schema.org的JSON-LD保修/如何使用保修属性

时间:2017-01-03 05:34:44

标签: schema.org json-ld

(这是一个自我回答的问题。由于用户要求提供微数据,而不是JSON-LD,因此未在this post中发布

如何使用https://schema.org/warranty中列出的schema.org属性“保修”?。

没有提供示例,即使是JSON-LD格式也没有。例如, offers 上的文章提供了以下示例:

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

1 个答案:

答案 0 :(得分:1)

正确用法如下(HTML代码中的某处):

Google's Structured Data Testing Tool. You can check it too上进行了测试。

<script type="application/ld+json">
{
  "@context" : "http://schema.org/",
  "@type" : "Product",
  "name": "Sample product",
  "offers" : {
    "@type" : "Offer",
    "description": "Producto de Seiteka",
    "availability": "http://schema.org/InStock",
    "priceSpecification" : {
      "@type" : "PriceSpecification",
      "priceCurrency": "USD",
          "price": "45"
    },
    "warranty": {
      "@type": "WarrantyPromise",
      "durationOfWarranty" : {
        "@type" : "QuantitativeValue",
        "value": "6",
        "unitCode": "MON"
      },
      "warrantyScope": {
        "@type" : "WarrantyScope",
        "description": "Product listed in this page has 6 months of warranty."
      }
    }
  }
}
</script>

组织says the warranty property must be inside Offer or Demand, and that it should have WarrantyPromise inside

他们也say WarrantyPromise can have the properties durationOfWarranty and warrantyScope

For durationOfWarranty you must use QuantitativeValueallows value将被使用。

For warrantyScope you must use WarrantyScopeallows description将被使用。

最后,他们谈论了warrantyPromise not WarrantyPromise ),指出WarrantyPromise属性必须位于warrantyPromise内。