我有一个Schema.org Organization
,我想支持其中的营业时间。 JSON-LD有可能吗?
我在hoursAvailable
上看过ContactPoint
属性,但它似乎只支持微数据。
答案 0 :(得分:0)
所有Schema.org属性都可以用于所有语法。
财产的示例仅供参考。如果示例仅以一种语法提供,则并不意味着此属性不能用于其他语法;它只是意味着没有人转换过这些例子。
因此,您可以在JSON-LD中使用hoursAvailable
property。
答案 1 :(得分:0)
我尝试将hoursAvailable添加为Person的ContactPoint的属性,以使用JSON-LD指定办公时间。 http://linter.structured-data.org/没有抱怨,但https://search.google.com/structured-data/testing-tool确实报错了。我发现如果我只为hoursAvailable提供了一个值,那么我没有任何报告的错误:
<script type="application/ld+json">
{
"@context": "http://schema.org",
"@type": "WebPage",
"breadcrumb":
{
"@type": "BreadcrumbList",
"itemListElement": [
{
"@type": "ListItem",
"position": 1,
"item":
{
"@id": "http://example.com/",
"name": "One"
}
}
]
},
"mainEntity":
{
"@type": "Person",
"contactPoint" :
{
"@type": "ContactPoint",
"contactType": "customer service",
"url" : "http://example.com/",
"hoursAvailable":
{
"@type": "OpeningHoursSpecification",
"dayOfWeek": "http://schema.org/Monday",
"validFrom": "2018-01-08",
"validThrough": "2018-04-13",
"opens": "09:30:00",
"closes": "11:00:00"
}
}
}
}
</script>
我没有进一步追求这个解决方案。我决定使用以下标记将我的办公时间描述为服务,谷歌的结构化数据测试工具没有报告任何错误。
<script type="application/ld+json">
{
"@context": "http://schema.org",
"@type": "WebPage",
"breadcrumb":
{
"@type": "BreadcrumbList",
"itemListElement": [
{
"@type": "ListItem",
"position": 1,
"item":
{
"@id": "http://example.com/",
"name": "One"
}
}
]
},
"mainEntity":
{
"@type" : "Service",
"url" : "http://example.com/",
"hoursAvailable": [
{
"@type": "OpeningHoursSpecification",
"dayOfWeek": "http://schema.org/Monday",
"validFrom": "2018-01-08",
"validThrough": "2018-04-13",
"opens": "09:30:00",
"closes": "11:00:00"
},
{
"@type": "OpeningHoursSpecification",
"dayOfWeek": "http://schema.org/Tuesday",
"validFrom": "2018-01-08",
"validThrough": "2018-04-13",
"opens": "09:30:00",
"closes": "11:00:00"
},
{
"@type": "OpeningHoursSpecification",
"dayOfWeek": "http://schema.org/Wednesday",
"validFrom": "2018-01-08",
"validThrough": "2018-04-13",
"opens": "15:30:00",
"closes": "17:00:00"
},
{
"@type": "OpeningHoursSpecification",
"dayOfWeek": "http://schema.org/Thursday",
"validFrom": "2018-01-08",
"validThrough": "2018-04-13",
"opens": "15:00:00",
"closes": "16:30:00"
}
]
}
}
</script>