简体   繁体   中英

Google's RDFa breadcrumbs for home and current page?

As I couldn't find a proper RDFa example anywhere, I thought I'd ask a question here. OnGoogle's page there are examples of breadcrumbs, using either Microdata or RDFa markup. When you click on "See Markup" under "RDFa" next to "Example 2" you'll see an example of markup for this particular type of breadcrumb (As far as I know, images in breadcrumbs are optional, so I got rid of them):

<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>

Unfortunately it doesn't say anything about Home and Current Page breadcrumb, so I'm not sure how to construct it.

To be more exact with my question, what property and typeof attribute to use for home and current page? Shall I just use the first link from above example for Home Page without changing anything in the markup and for Current Page only omit the link, as it's not really needed so it would look like this?:

<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>

There is no reason to treat the entry for the home page differently, so yes, provide it just like the other items.

If you want to provide an entry for the current page without showing a link, you still might want to specify the WebPage type. This would also allow you to provide the current page's URL without adding a user-visible link to the page.

<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>

Instead of the a element, it uses a span element.
The resource attribute (from RDFa) specifies the URI of the item (without creating a hyperlink).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM