: How to use more than 1 schema.org schema on a web page How do you add more than one schema to a web page? I am using the Organization and WebSite schemas on my home page. I am writing
How do you add more than one schema to a web page?
I am using the Organization and WebSite schemas on my home page. I am writing the markup in JSON-LD format.
The Organization schema for the knowledge graph:
<script type="application/ld+json">
{
"@@context": "http://schema.org",
"@@type": "Organization",
"name": "My Website Name",
"url": "http://www.example.com",
"sameAs": [
"http://www.facebook.com/example-com",
"http://www.instagram.com/example-com"
]
}
</script>
and the WebSite schema to include my site name in search results (if Google ever decides to implement this):
<script type="application/ld+json">
{
"@context" : "http://schema.org",
"@@type" : "WebSite",
"name" : "My Website Name",
"url" : "http://www.example.com"
}
</script>
As you can see they both have the same name and url properties.
Do I need to specify the 2 separate like I did or can just concatenate the 2? Any preference of which has to go first on the page?
UPDATE 23 February 2016:
I ended with the following using unor's help:
<script type="application/ld+json">
{
"@context": "http://schema.org",
"@graph": [{
"@type": "WebSite",
"name": "My Website Name",
"url": "http://www.example.com"
}, {
"@type": "WebPage",
"name": "My Website Name",
"url": "http://www.example.com"
}, {
"@type": "Organization",
"name": "My Website Name",
"url": "http://www.example.com",
"sameAs": [
"http://www.facebook.com/example-com",
"http://www.instagram.com/example-com"
]
}]
}
</script>
More posts by @Radia820
3 Comments
Sorted by latest first Latest Oldest Best
In JSON-LD (instead of Microdata/RDFa) you have to repeat the property and its value for each node.
Instead of using a separate script element for each node, you could also use a single script element that contains all your nodes as value of @graph . That way you only have to define the @context (and possibly custom properties) one time.
<script type="application/ld+json">
{
"@context": "http://schema.org",
"@graph":
[
{
"@type": "WebSite"
},
{
"@type": "Organization"
}
]
}
</script>
The order of the script elements (or the nodes in @graph ) shouldn’t matter
You can definitely concatenate them. I have seen it done on a lot of websites. As an example check how it is done on yoast.com . And the structured data validation tool from Google seems to say the code is ok.
If you already add website URL in organization, then you don't need to add website schema in your website.
If you're using organization schema, then I suggest to use logo properties as well.
"logo": "http://www.example.com/logo.png"
Another thing, I want to say, Google does not support all the schema and it's properties, so use those schema, which is currently supported by Google.
Terms of Use Create Support ticket Your support tickets Stock Market News! © vmapp.org2024 All Rights reserved.