【发布时间】:2017-04-27 14:06:08
【问题描述】:
我正在尝试获得一个很好的 json-ld,它将 schema.org/Product 定义与一些自定义元素相结合。
我来自xsd背景,json-ld的可扩展性似乎很难实现。
我从在 Google (https://developers.google.com/search/docs/guides/search-gallery) 上找到的产品模板标记开始并尝试对其进行扩展(我想添加类似 mydomain:tags 的内容),但我不知道该怎么做。
<script type="application/ld+json">
{
"@context": ["http://schema.org/",
{"mydomain": "http://mystuff.com/"}],
"@type": "Product",
"name": "Executive Anvil",
"image": "http://www.example.com/anvil_executive.jpg",
"description": "Sleeker than ACME's Classic Anvil, the Executive Anvil is perfect for the business traveler looking for something to drop from a height.",
"mpn": "925872",
"brand": {
"@type": "Thing",
"name": "ACME"
},
"aggregateRating": {
"@type": "AggregateRating",
"ratingValue": "4.4",
"reviewCount": "89"
},
"offers": {
"@type": "Offer",
"priceCurrency": "USD",
"price": "119.99",
"priceValidUntil": "2020-11-05",
"itemCondition": "http://schema.org/UsedCondition",
"availability": "http://schema.org/InStock",
"seller": {
"@type": "Organization",
"name": "Executive Objects"
}
},
"mydomain:tags" : {}
}
</script>
任何关于我在这里做错的线索将不胜感激。 这可能是一件很愚蠢的事情......
【问题讨论】:
-
如果您从 json-ld.org/playground 复制产品示例并将其粘贴到 Google 的结构化数据测试工具 (search.google.com/structured-data/testing-tool) 中会出现 4 个错误?
-
问题中的例子有什么问题?
-
结构化数据测试工具说它无法识别“产品”类型对象的属性mystuff.com/tags。
-
是的,但您无法更改此设置。 Google 的 SDTT 不是通用的结构化数据验证器,而是 Google 搜索结果功能的验证器,主要使用 Schema.org。
-
好的,我的例子,带有“mydomain:tags”:{} 是有效的 json-ld?
标签: json-ld web-standards