Google 结构数据面包屑标记

Google Structure Data Breadcrumb Markup

我正在尝试为 Google 结构数据实现面包屑导航,以下是我尝试构建的内容。

首页 > 类别 > 页面名称

当我的经理建议语法时,问题就开始了。

这是我的经理给我的建议。

<div itemscope itemtype="http://data-vocabulary.org/Breadcrumb">
  <a href="https://www.example.com" itemprop="url">
    <span itemprop="title">Home</span>
  </a> >
</div>  

<div itemscope itemtype="http://data-vocabulary.org/Breadcrumb">
  <a href=" https://www.example.com/blog" itemprop="url">
    <span itemprop="title">Category</span>
  </a> >
</div>  

<div itemscope itemtype="http://data-vocabulary.org/Breadcrumb">
  <a href=" https://www.example.com/blog/can-work-pregnant/" itemprop="url">
    <span itemprop="title">Page Name</span></a>
</div>  

这是我认为正确的。

<div itemscope itemtype="http://schema.org/BreadcrumbList">
  <span itemprop="itemListElement" itemscope itemtype="http://schema.org/ListItem">
    <a itemscope itemtype="http://schema.org/Thing" itemprop="item" href="https://example.com/">
        <span itemprop="name">Home</span></a>
        <meta itemprop="position" content="1" />
  </span>
  <span class="seperator">></span>
  <span itemprop="itemListElement" itemscope itemtype="http://schema.org/ListItem">
    <a itemscope itemtype="http://schema.org/Thing" itemprop="item" href="https://example.com/category">
      <span itemprop="name">Category</span></a>
      <meta itemprop="position" content="2" />
      </span>
      <span class="seperator">›</span>
    <span itemprop="itemListElement" itemscope itemtype="http://schema.org/ListItem">
    <a itemscope itemtype="http://schema.org/Thing" itemprop="item" href="https://example.com/category/page">
      <span itemprop="name">Page Name</span></a>
      <meta itemprop="position" content="3" />
  </span>
</div>

如果您尝试这两种语法,您会看到第一个创建了 3 个单独的面包屑,而不是一个包含完整数据的面包屑。

但既然这是我经理的建议,除非我有充分的理由,否则我不想拒绝。

所以,我想知道的是使用第一种语法的优缺点。请帮我。提前致谢。

你的方法是正确的。它产生一个 3 级面包屑路径。你的经理是不正确的。他们的方法只做了 3 个不同的 "trails" 一个级别。如果只有一项就不是trail