几年来,我们一直对面包屑使用干净的数据-词汇表. for标记,但是对它的支持正在消失。因此,我们一直试图切换到RDFa,但在验证方面遇到了问题。
如果我们简单地复制粘贴代码片段,它就不会有任何问题。
<ol vocab="https://schema.org/" typeof="BreadcrumbList" style="list-style:none; padding:0; margin:0;">
<li property="itemListElement" typeof="ListItem" style="display:inline-block;">
<a property="item" href="/">
<span property="name">Index</span></a>
<meta property="position" content="1"> </li>
» <li property="itemListElement" typeof="ListItem" style="display:inline-block;">
<a property="item" typeof="WebPage"
href="archive/">
<span property="name">News</span></a>
<meta property="position" content="2"> </li> » <li property="itemListElement" typeof="ListItem" style="display:inline-block;">
<a property="item" typeof="WebPage"
href="playstation-3/">
<span property="name">PlayStation 3</span></a>
<meta property="position" content="3">
</li>
</ol>但是,如果我们试图用页面上的代码验证整个URL,面包屑就会通过抓取其他元标记抛出错误,完全超出了面包屑列表代码的范围。
有人知道为什么会发生这种事吗?所有的面包屑都是"WebPage“类型,但是错误都发生在第一个ListItem上。例如,请看下面的图片:

这是代码问题吗?还是谷歌测试工具的问题?如果我简单地将第一个列表条目作为一个非URL/非web页面,那么问题就解决了。
发布于 2020-03-21 22:29:27
这可能是一个层次问题。我也曾面对过。我建议使用Json/ld格式,它是基于JSON的,并写在script标记中。
一个简单的例子:
<html>
<head>
<title>Award Winners</title>
<script type="application/ld+json">
{
"@context": "https://schema.org",
"@type": "BreadcrumbList",
"itemListElement": [{
"@type": "ListItem",
"position": 1,
"name": "Books",
"item": "https://example.com/books"
},{
"@type": "ListItem",
"position": 2,
"name": "Science Fiction",
"item": "https://example.com/books/sciencefiction"
},{
"@type": "ListItem",
"position": 3,
"name": "Award Winners"
}]
}
</script>
</head>
<body>
</body>
</html>您可以在谷歌开发人员上找到更多信息。
https://webmasters.stackexchange.com/questions/128465
复制相似问题