问题
I maintain a webpage that contains information about my organisation. I have embedded JSON-LD as shown below.
{
"@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"
}
}
}
If I want to use "Organisation" in "WebSite" on some other page, do I need to repeat the whole of the above structure or just the ID like below?
{
"@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 is very attractive but I couldnot get this doubt cleared so far.
(Please ignore any syntax problems in my JSON-LD.)
回答1:
Theoretically the @id
is enough (given that you also include it in the first page) but practically I would include it as not all clients/crawlers merge the data or go to look elsewhere.
回答2:
For the purposes of the knowledge graph, if they scan both your organization page and your website, then simply linking your website to the organization URL should be sufficient for them to retrieve everything; that is, after all, the whole point of Linked Data. That said, it's common for people to repeat some portion of the referenced information, for in-graph access, such as the organization name. You're not using an organization name, so this wouldn't be too useful.
You're WebPage might look like the following:
{
"@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"
}
}
Then the organization might look like:
{
"@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"
}
}
}
}
Or you could just link the author directly to the organization URL:
{
"@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"}
}
Note that author
is not defined with @type: @id
, so you need to make it explicit that it's a link.
来源:https://stackoverflow.com/questions/32122087/repeat-whole-json-ld-structure-or-only-the-id