The microdata markup below works perfectly, Google's structured data testing tool shows one CollectionPage
and WebSite/WebPage
as children.
<body itemscope itemtype="https://schema.org/CollectionPage">
<span itemscope itemtype="https://schema.org/WebSite" itemprop="hasPart">
<a href="https://springfield-xxxx.us" itemprop="url">Official site of Springfield</a>
</span>
<span itemscope itemtype="https://schema.org/WebPage" itemprop="hasPart">
<a href="https://facebook.com/group/XXXX" itemprop="url">Local events in Springfield</a>
</span>
<span itemscope itemtype="https://schema.org/WebPage" itemprop="hasPart">
<a href="https://news.us/city/springfield-xxxx" itemprop="url">Latest news in Springfield</a>
</span>
</body>
However when I add JSON-LD Google's structured data testing tool shows objects CollectionPage
and WebPage/WebSite
separately like if they had no connection. Here is a sample with JSON-LD:
<!DOCTYPE html>
<html>
<head>
<script type="application/ld+json">
{
"description": "...",
"author": {"@type":"Person", "name": "Homer J. Simpson"},
"@type": "CollectionPage",
"url": "http://my-springfield.us/sites",
"publisher": {
"@type": "Organization",
"logo": "Object of type ImageObject here",
"name": "Homer J. Simpson"
},
"image": "...",
"headline": "Springfield Sites",
"sameAs": ["..."],
"@context": "http://schema.org"
}
</script>
</head>
<body>
<span itemscope itemtype="https://schema.org/WebSite" itemprop="hasPart">
<a href="https://springfield-xxxx.us" itemprop="url">Official site of Springfield</a>
</span>
<span itemscope itemtype="https://schema.org/WebPage" itemprop="hasPart">
<a href="https://facebook.com/group/XXXX" itemprop="url">Local events in Springfield</a>
</span>
<span itemscope itemtype="https://schema.org/WebPage" itemprop="hasPart">
<a href="https://news.us/city/springfield-xxxx" itemprop="url">Latest news in Springfield</a>
</span>
</body>
</html>
I tried putting @id
in JSON-LD and itemid
on the body
to no avail: Google testing tool shows two separate CollectionPages or two separate items of other types.
My question: how to connect JSON-LD and microdata so that Google testing tool shows one CollectionPage
with WebPage/WebSite
as children/props?