我维护一个包含有关我的组织的信息的网页。我已经嵌入了JSON-LD,如下所示。
{
"@context" : "http://schema.org",
"@id" : "http://example.com"
"@type" : "Organization",
"location": {
"@type": "Place",
"address": {
"@type": "PostalAddress",
"addressLocality": "Shivalik City, Kharar-Landran Road,",
"addressRegion": "Distt. Mohali, Punjab",
"addressCountry":"IN",
"postalCode":"140307",
"streetAddress" : "SCF No. 5"
}
}
}
如果我想使用"组织"在" WebSite"在其他一些页面上,我是否需要重复上述整个结构或仅重复下面的ID?
{
"@context" : "http://schema.org",
"@type" : "WebSite",
"name" : "Hoven",
"alternateName" : "Hoven Online Market",
"url" : "http://www.hoven.in",
"author":
[{ "@context" : "http://schema.org",
"@type" : "Organization",
"@id" : "http://example.com" <---------------
}]
}
JSON-LD非常有吸引力,但到目前为止我无法清除这个疑问。
(请忽略我的JSON-LD中的任何语法问题。)
答案 0 :(得分:1)
理论上@id
就足够了(假设你也将它包含在第一页中)但实际上我会包括它,因为并非所有客户端/抓取工具合并数据或去其他地方。
答案 1 :(得分:0)
出于知识图的目的,如果他们同时扫描您的组织页面和您的网站,那么只需将您的网站链接到组织URL就足以让他们检索所有内容;毕竟,这就是关联数据的全部要点。也就是说,人们重复参考信息的某些部分,以进行图形内访问,例如组织名称,这是很常见的。您没有使用组织名称,因此这不会太有用。
您的WebPage可能如下所示:
{
"@context" : "http://schema.org",
"@type" : "WebSite",
"name" : "Hoven",
"alternateName" : "Hoven Online Market",
"@id" : "http://www.hoven.in",
"url" : "http://www.hoven.in",
"author": {
"@id" : "http://example.com",
"name": "My Organization"
}
}
然后组织可能看起来像:
{
"@context" : "http://schema.org",
"@id" : "http://example.com",
"@type" : "Organization",
"name": "My Organization",
"location": {
"@type": "Place",
"address": {
"@type": "PostalAddress",
"addressLocality": "Shivalik City, Kharar-Landran Road,",
"addressRegion": "Distt. Mohali, Punjab",
"addressCountry":"IN",
"postalCode":"140307",
"streetAddress" : "SCF No. 5"
}
}
}
}
或者您可以直接将作者链接到组织网址:
{
"@context" : "http://schema.org",
"@type" : "WebSite",
"name" : "Hoven",
"alternateName" : "Hoven Online Market",
"@id" : "http://www.hoven.in",
"url" : "http://www.hoven.in",
"author": {"@id" : "http://example.com"}
}
请注意author
未定义为@type: @id
,因此您需要明确指出它是一个链接。