2

I want to tie together two kinds of structured data: WebPage, which is JSON-LD, and BreadcrumbList, which is inline microdata.

The topic is not a duplicate! I've seen many similar answered questions at SO about the subject - but i tested everyone with Google Structured Data Test tool, and no single answer was validely tested.

The code example is:

<script type="application/ld+json">
{
"@context": "http://schema.org",
"@type": "Webpage",
"id": "https://www.example.com#Webpage",
"breadcrumb": {
"@type": "BreadcrumbList",
"@id": "https://www.example.com#BreadcrumbList"
}
}
</script>
<nav class="breadcrumbs">
<ol itemscope itemtype="http://schema.org/BreadcrumbList" itemid="https://www.example.com#BreadcrumbList">
<li itemprop="itemListElement" itemscope itemtype="http://schema.org/ListItem">
<a itemprop="item" rel="up up up" title="a" href="/a/">
<span itemprop="name">a</span></a>
<meta itemprop="position" content="1" /></li>
<li itemprop="itemListElement" itemscope itemtype="http://schema.org/ListItem">
<a itemprop="item" rel="up up" title="b" href="/b/">
<span itemprop="name">b</span></a>
<meta itemprop="position" content="2" /></li>
<li itemprop="itemListElement" itemscope itemtype="http://schema.org/ListItem">
<a itemprop="item" rel="up" title="c" href="/c/">
<span itemprop="name">c</span></a>
<meta itemprop="position" content="3" /></li>
</ol>
</nav>

As i said, WebPage is the main data type in JSON-LD snippet. It has the secondary data type BreadcrumbList, which has an id. The BreadcrumbList inside microdata relates with itemid to the same from JSON-LD - i expect, that the test tool shows the relation between the BredcrumbList from JSON-LD and those from microdata. But no: the test tool displays them as different, and triggers an error at JSON-LD snippet because it hasn't required ItemList.

Is it a bug of the test tool or do i missing something substantial?

PS: The same construction, build only on JSON-LD is validated as expected:

<script type="application/ld+json">
{
"@context": "http://schema.org",
"@type": "Webpage",
"id": "https://www.example.com#Webpage",
"breadcrumb": {
"@type": "BreadcrumbList",
"@id": "https://www.example.com#BreadcrumbList",
"itemListElement": [
{
"@type": "ListItem", 
"id": "https://www.example.com#ListItem"
}
]
}
}
</script>
<script type="application/ld+json">
{
"@context": "http://schema.org",
"@type": "ListItem",
"id": "https://www.example.com#ListItem",
"position": "1",
"item": {
"@id": "https://www.example.com/item1",
"name": "name1"
}
}
}
</script>
Evgeniy
  • 2,337
  • 2
  • 28
  • 68
  • Related questions: [Google does not correctly merge microdata and json+ld in the same page using same URI id](https://stackoverflow.com/q/33756091/1591669) ··· [Mixing JSON-LD CollectionPage and Microdata \`hasPart\` of Schema.org](https://stackoverflow.com/q/50667838/1591669) – unor Dec 21 '18 at 15:36
  • 1
    An error in your snippets, but it’s not related to your issue: it must be `WebPage` instead of `Webpage` (Schema.org terms are case-sensitive) – unor Dec 21 '18 at 15:37

1 Answers1

3

I've been working this problem out for about a month; it gets cray fast.

so, JSON+LD is just a container for linked data. I think your question is in the realm of 'can you mix microformats' ie: schema, RDFa, Microdata .. and the answer is Yes!

I use json+ld format for Google with top-level link definitions; things that are somewhat abstract like organizations, localBusiness etc. then to refine deeper, i use RDFa/Microdata inline for page elements. stuff like breadcrumb, title, tele, etc.

Google supports each microformat (with a preference for JSON-LD) and there' doesn't seem to be any conflict when mixing Attributes just as long as the data links are consistent and the syntax is valid. so you can use what is appropriate for the code structure.

so your code example a valid approach according to google dev docs and a good developer, and as of 2019 creates this approach creates a valid page. it's made development much easier.

  • Nö, it's not a question of whether, but rather of how.. The tieing with I'd isn't validated properly by google's test tool, while it is validated by non-google test tool, like linter – Evgeniy Jan 11 '19 at 23:18
  • So you want to duplicate the linked data? as in use two data schemes to define the same data objects? hmm. I'll have to look into that, but Why have the redundancy? – andres.plashal Jan 11 '19 at 23:21
  • So there's a couple correction to your question. 1. 'WebPage' is a data type in schema.org, not json+lt you can serve webpage in a couple microformats (scheme, microdata, RDFa) & 2. i think you're still confusing structured data formats with containers formats – andres.plashal Jan 11 '19 at 23:29