首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >切换页面上的面包屑Google验证失败

切换页面上的面包屑Google验证失败
EN

Webmasters Stack Exchange用户
提问于 2020-03-21 00:05:58
回答 1查看 711关注 0票数 2

几年来,我们一直对面包屑使用干净的数据-词汇表. for标记,但是对它的支持正在消失。因此,我们一直试图切换到RDFa,但在验证方面遇到了问题。

如果我们简单地复制粘贴代码片段,它就不会有任何问题。

代码语言:javascript
复制
<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页面,那么问题就解决了。

EN

回答 1

Webmasters Stack Exchange用户

发布于 2020-03-21 22:29:27

这可能是一个层次问题。我也曾面对过。我建议使用Json/ld格式,它是基于JSON的,并写在script标记中。

一个简单的例子:

代码语言:javascript
复制
<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>

您可以在谷歌开发人员上找到更多信息。

票数 1
EN
页面原文内容由Webmasters Stack Exchange提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://webmasters.stackexchange.com/questions/128465

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档