Usage of schema.org's Warranty with JSON-LD /

2019-07-31 10:09发布

(This is a self-answered question. It wasn't posted in this post since the user asked for microdata, not JSON-LD)

How do you use the schema.org property "Warranty", listed in https://schema.org/warranty?.

There're no examples provided, not even for JSON-LD format. For instance, the article on offers provides examples like this:

<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条回答
手持菜刀,她持情操
2楼-- · 2019-07-31 10:22

The correct usage is as follows (somewhere inside your HTML code):

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

The organization says the warranty property must be inside Offer or Demand, and that it should have WarrantyPromise inside.

They also say WarrantyPromise can have the properties durationOfWarranty and warrantyScope.

For durationOfWarranty you must use QuantitativeValue, which allows value to be used.

For warrantyScope you must use WarrantyScope, which allows description to be used.

Finally, they talk something about warrantyPromise (not WarrantyPromise) stating that WarrantyPromise property must be inside warrantyPromise.

查看更多
登录 后发表回答