【问题标题】:Marking the last breadcrumb item in Microdata标记微数据中的最后一个面包屑项目
【发布时间】:2017-06-18 05:29:30
【问题描述】:

以下代码:

<nav id="breadcrumbs-as-title" xmlns:v="http://rdf.data-vocabulary.org/#" >
  <ul class="f1 my-levels-2" itemprop="breadcrumb" >
     <li typeof="v:Breadcrumb" ><a href="url1.html" title="title 1" rel="v:url" property="v:title" >title 1</a></li>
     <li typeof="v:Breadcrumb" ><a href="url2.html" title="title 2" rel="v:url" property="v:title" >title 2</a></li>
     <li typeof="v:Breadcrumb" ><strong><span property="v:title" >title 3 (= the title of the current page)</span></strong></li>
  </ul>
</nav>

我看到以下错误:

@type: 面包屑
标题:标题 3
url:url 字段的值是必需的。

因为我最后一个 &lt;li&gt; 没有 URL。

我应该将最后一个 &lt;li&gt; 标记为面包屑吗?或删除标记,作为代码 - Breadcrumb microdata help

我应该按照How to markup the last non linking item in breadcrumbs list using JSON-LD 中的建议添加“虚拟”项目吗?

【问题讨论】:

    标签: html breadcrumbs microdata rdfa structured-data


    【解决方案1】:

    您的示例主要使用 RDFa 属性(typeof、property、...)和一个微数据属性(itemprop)。除非在这个例子中没有显示更多的微数据,否则像这样混合这两种语法是没有意义的。

    此外,您正在使用不再维护的词汇表 Data-Vocabulary.org。你没有说明你是否有一个特定的用例,但很可能你想使用词汇表Schema.org(根据他们的文档,它是the only vocabulary supported by Google)。

    在 Schema.org 中,您将使用类型 BreadcrumbList。您可以使用微数据、RDFa 或 JSON-LD。请参阅页面底部的示例。

    正如my answer 中提到的您链接到的问题,Schema.org 表示面包屑“通常以当前页面结尾”,Google 表示其面包屑相关功能“可能包含或省略它出现的页面的面包屑”。

    如果您确实提供了最后一项,但您不想链接它,您可以提供一个隐藏的 URL(在 RDFa/Microdata 中使用 link 元素),

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2011-06-30
      • 2016-02-14
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-07-07
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多