Mobile app version of vmapp.org
Login or Join
Berryessa370

: Can I mix Microdata and JSON-LD on the same page for different entity My website is using JSON-LD and Microdata. For example, in BreadcrumbList, I have used Microdata format, and for others

@Berryessa370

Posted in: #JsonLd #Microdata #SchemaOrg #StructuredData

My website is using JSON-LD and Microdata.

For example, in BreadcrumbList, I have used Microdata format, and for others (like Organization, TouristAttraction) JSON-LD has been used.

Can I mix Microdata and JSON-LD on the same page for different entities or should I go with only one format?

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @Berryessa370

1 Comments

Sorted by latest first Latest Oldest Best

 

@Sherry384

It should be fine to use different syntaxes on the same page.

It has one drawback, though: If you want to connect entities specified in different syntaxes, you can’t nest them. You have to use URIs instead.

Drawback example

You can connect a BreadcrumbList to a WebPage with the breadcrumb property.

When using only one syntax, you can simply nest the items:

<!-- Microdata only -->
<div itemscope itemtype="http://schema.org/WebPage">
<div itemprop="breadcrumb" itemscope itemtype="http://schema.org/BreadcrumbList">
</div>
</div>


<!-- JSON-LD only -->
<script type="application/ld+json">
{
"@context": "http://schema.org",
"@type": "WebPage",
"breadcrumb":
{
"@type": "BreadcrumbList"
}
}
</script>


But if you mix syntaxes, you have to use URIs instead:

<!-- Microdata, giving the entitiy an URI with the 'itemid' attribute -->
<div itemscope itemtype="http://schema.org/BreadcrumbList" itemid="#page-breadcrumbs">
</div>

<!-- JSON-LD, referencing the URI "#page-breadcrumbs" which is specified in the Microdata -->
<script type="application/ld+json">
{
"@context": "http://schema.org",
"@type": "WebPage",
"breadcrumb":
{
"@type": "BreadcrumbList",
"@id": "#page-breadcrumbs"
}
}
</script>

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme