家用和当前页面的谷歌RDFa面包屑?

问题描述 投票:1回答:1

由于我无法在任何地方找到合适的RDFa示例,我想我会在这里问一个问题。在Google's page上有面包屑的例子,使用Microdata或RDFa标记。当您单击“示例2”旁边的“RDFa”下的“查看标记”时,您将看到此特定类型的痕迹的标记示例(据我所知,面包屑中的图像是可选的,因此我摆脱了他们):

<ol vocab="http://schema.org/" typeof="BreadcrumbList">
  <li property="itemListElement" typeof="ListItem">
    <a property="item" typeof="WebPage" href="https://example.com/books">
      <span property="name">Books</span>
    </a>
    <meta property="position" content="1">
  </li>
  ›
  <li property="itemListElement" typeof="ListItem">
    <a property="item" typeof="WebPage" href="https://example.com/books/sciencefiction">
      <span property="name">Science Fiction</span>
    </a>
    <meta property="position" content="2">
  </li>
  ›
  <li property="itemListElement" typeof="ListItem">
    <a property="item" typeof="WebPage" href="https://example.com/books/sciencefiction/awardwinnders">
      <span property="name">Award Winners</span>
    </a>
    <meta property="position" content="3">
  </li>
</ol>

不幸的是,它没有说明Home和Current Page面包屑,所以我不确定如何构建它。

更准确地说,我的问题是什么propertytypeof属性用于家庭和当前页面?我只是使用上面示例中的第一个链接来进行主页而不更改标记中的任何内容,而对于当前页面只省略链接,因为它不是真的需要所以它看起来像这样吗?:

<li property="itemListElement" typeof="ListItem">
  <a property="item" typeof="WebPage" href="https://example.com">
    <span property="name">Home Page</span>
  </a>
  <meta property="position" content="1">
</li>

   // Above is for Home, below is for Current. I omitted items 2 and 3 which are positioned somwhere in between..

<li property="itemListElement" typeof="ListItem">
  <span property="name">Current Page</span>
  <meta property="position" content="4">
</li>
html schema.org breadcrumbs google-rich-snippets rdfa
1个回答
1
投票

没有理由以不同的方式处理主页的条目,所以是的,就像其他项一样提供它。

如果要为当前页面提供条目而不显示链接,您仍可能需要指定WebPage类型。这还允许您提供当前页面的URL,而无需向页面添加用户可见链接。

<li property="itemListElement" typeof="ListItem">
  <span property="item" typeof="WebPage" resource="/current-page.html">
    <span property="name">Current Page</span>
  </span>
  <meta property="position" content="4">
</li>

它使用a元素而不是span元素。 resource属性(来自RDFa)指定项目的URI(不创建超链接)。

© www.soinside.com 2019 - 2024. All rights reserved.