Mobile app version of vmapp.org
Login or Join
Radia820

: 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

@Radia820

Posted in: #Html #Html5 #JsonLd #SchemaOrg

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>

10.03% popularity Vote Up Vote Down


Login to follow query

More posts by @Radia820

3 Comments

Sorted by latest first Latest Oldest Best

 

@Sherry384

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

10% popularity Vote Up Vote Down


 

@Berryessa370

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.

10% popularity Vote Up Vote Down


 

@Sarah324

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.

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme