下面的微数据标记工作得很好,Google 的结构化数据测试工具显示一个CollectionPage
and WebSite/WebPage
作为孩子。
<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>
但是当我添加 JSON-LD 时Google 的结构化数据测试工具显示对象CollectionPage
and WebPage/WebSite
分开就像他们没有联系一样。以下是 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>
我尝试把@id
在 JSON-LD 中和itemid
on the body
无济于事:谷歌测试工具显示两个单独的CollectionPages或其他类型的两个单独的项目。
我的问题:如何连接 JSON-LD 和微数据,以便 Google 测试工具显示一个CollectionPage
with WebPage/WebSite
作为孩子/道具?