Usage of schema.org's Warranty with JSON-LD / How to use Warranty property

我的梦境 提交于 2019-12-11 05:45:49

问题


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


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.



来源:https://stackoverflow.com/questions/41437038/usage-of-schema-orgs-warranty-with-json-ld-how-to-use-warranty-property

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!