可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
There isn't much info about implementing a breadcrumb using schema.org markup. So far, I could get two official documents -- one showing this:
<div itemscope itemtype="http://schema.org/Property" itemid="http://schema.org/breadcrumb">
<link itemprop="domain" href="http://schema.org/WebPage"/>
<link itemprop="range" href="http://schema.org/Text"/>
</div>
And another showing this:
<body itemscope itemtype="http://schema.org/WebPage">
<div itemprop="breadcrumb">
<a href="category/books.html">Books</a> >
<a href="category/books-literature.html">Literature & Fiction</a> >
<a href="category/books-classics">Classics</a>
</div>
</body>
The two markups are quite different. Do they make any sense to you? If they do, how do I enclose the following plain breadcrumb code with that markup -- the RIGHT WAY?
<body>
<span id="breadcrumbs">
<a rel="home" href="http://example.com">
<span>Noob Archive</span>
</a> »
<span>
<a href="http://example.com/topic/html/">
<span>HTML</span>
</a> »
<strong>Best Practices: Markup for Setting up Breadcrumbs on Web Pages</strong>
</span>
</span>
</body>
Thanks!
回答1:
schema.org finally released a new breadcrumb markup system in the schema.org v1.92 update (released 2014-12-11). The new breadcrumb system is an extension of ItemList
called BreadcrumbList
. Each BreadcrumbList
contains multiple ListItem
elements. This allows for multiple breadcrumb trails per page, separation of each individual link as a separate ListItem
, and provides a wrapper around the entire breadcrumbs. This should satisfy pretty much every use case.
Here is the Microdata example from schema.org:
<ol itemscope itemtype="http://schema.org/BreadcrumbList">
<li itemprop="itemListElement" itemscope
itemtype="http://schema.org/ListItem">
<a itemprop="item" href="https://example.com/dresses">
<span itemprop="name">Dresses</span></a>
<meta itemprop="position" content="1" />
</li>
› <li itemprop="itemListElement" itemscope
itemtype="http://schema.org/ListItem">
<a itemprop="item" href="https://example.com/dresses/real">
<span itemprop="name">Real Dresses</span></a>
<meta itemprop="position" content="2" />
</li>
</ol>
Google's recently redesigned Structured Data Testing Tool parses this markup properly. However, the redesign of the tool dropped the search preview, so it's difficult to say how Google will display breadcrumbs with this markup in Google search results (or if Google will use this data at all). The linter.structured-data.org parses this new markup correctly as well, but as mentioned there, "This preview is only shown as a example of what a search engine might display. It is to the discretion of each search engine provider to decide whether your page will be displayed as an enhanced search result or not in their search results pages."
Google Webmaster Tools recently added the ability to track how well your structured data is being indexed. It doesn't show which structured data is being used in search results, but it does show what data is being indexed on which pages, and also shows any errors in your structured data.
回答2:
The first document is the definition, so don't worry about that. It just says that breadcrumb is a text property of WebPages.
The example on http://schema.org/WebPage is the one you want to use and understand. It sets the breadcrumb snippet to a single text field saying "Books > Literature & Fiction > Classics".
You would do that like this:
<body itemscope itemtype="http://schema.org/WebPage">
<span id="breadcrumbs" itemprop="breadcrumb">
<a rel="home" href="http://example.com">
<span>Noob Archive</span>
</a> »
<span>
<a href="http://example.com/topic/html/">
<span>HTML</span>
</a> »
<strong>Best Practices: Markup for Setting up Breadcrumbs on Web Pages</strong>
</span>
</span>
</body>
The result would be "Noob Archive » HTML » Best Practices: Markup for Setting up Breadcrumbs on Web Pages".
You can use http://linter.structured-data.org/ to check how your item properties are parsed and http://diveintohtml5.ep.io/extensibility.html to find out more about the parse rules.
回答3:
The answer by @somori is incorrect -- but that is because the documentation on correctly marking up breadcrumbs with microdata / schema.org is widely incorrect.
EACH breadcrumb needs to be declared with an itemprop property, you can't just wrap them with itemprop="breadcrumb" in the containing div or span and use itemprop="child"
in the nested divs.
More info here:
http://lists.w3.org/Archives/Public/public-vocabs/2012Jan/0016.html
Do it like this, to get your breadcrumbs to show up in SERPs:
<div class="breadcrumb" itemscope itemtype="http://data-vocabulary.org/Breadcrumb">
<span class="breadcrumb-lead">YOU ARE HERE:</span><a title="Go to %title%." href="%link%" class="%type%" itemprop="url"><span itemprop="title">Homepage</span></a>
<div itemprop="child" itemscope itemtype="http://data-vocabulary.org/Breadcrumb" style="display: inline;"><a title="Go to %title%." href="%link%" class="%type%" itemprop="url"><span itemprop="title">Category One</span></a></div>
<div itemprop="child" itemscope itemtype="http://data-vocabulary.org/Breadcrumb" style="display: inline;"><a title="Go to %title%." href="%link%" class="%type%" itemprop="url"><span itemprop="title">Category Two</span></a></div>
</div>
Then test in google structured data testing tool:
http://www.google.com/webmasters/tools/richsnippets
回答4:
According to Google Webmaster Central Help Forum, it is not recommended by experts to use the schema.org breadcrumb markup for the time being,it's seems that "there is some sort of glitch in the schema.org breadcrumb structure".
Instead, it is exhorted to use the data-vocabulary.org breadcrumb markup, which Google and the other search engines can easily read as well.
A data-vocabulary.org Breadcrumb markup example:
<div>
<span itemscope itemtype="http://data-vocabulary.org/Breadcrumb">
<a href="http://www.example.com/" itemprop="url">
<span itemprop="title">example</span>
</a> >
</span>
<span itemscope itemtype="http://data-vocabulary.org/Breadcrumb">
<a href="http://www.example.com/fashion/" itemprop="url">
<span itemprop="title">Fashion</span>
</a> >
</span>
<span itemscope itemtype="http://data-vocabulary.org/Breadcrumb">
<a href="http://www.example.com/fashion/women/" itemprop="url">
<span itemprop="title">Women</span>
</a> >
</span>
<span itemscope itemtype="http://data-vocabulary.org/Breadcrumb">
<a href="http://www.example.com/fashion/women/boots/" itemprop="url">
<span itemprop="title">Boots</span>
</a>
</span>
</div>
回答5:
itemscope itemtype="...">
Is invalid in an xhtml page.
The correct syntax is:
itemscope="itemscope" itemtype="...">
回答6:
This validates now in Google's Structured Data Testing Tool
<nav role="navigation" class="breadcrumb" itemscope itemtype="http://schema.org/Breadcrumb">
<ol itemscope itemtype="http://schema.org/BreadcrumbList">
<li itemprop="itemListElement" itemscope itemtype="http://schema.org/ListItem">
<a itemprop="item" href="/"><span itemprop="name">Home</span></a>
<meta itemprop="position" content="1" />
</li>
<li itemprop="itemListElement" itemscope itemtype="http://schema.org/ListItem">
<a itemprop="item" href="/about-us"><span itemprop="name">About Us</span></a>
<meta itemprop="position" content="2" />
</li>
</ol>
</nav>
回答7:
@IssaBERTHE's answer is correct.
meh, need more rep to comment, For anyone using wordpress check out this plugin.
You can tailor it to fit your needs and follow google standard. It has the positioning built in.
Can Download here -> breadcrumb-trail plugin
It does need a little correcting. The file we need to edit is breadcrumb-trail-master\inc\breadcrumbs.php
You do need to edit line 213:
$breadcrumb = sprintf('<%1$s role="navigation" aria-label="%2$s" class="breadcrumb-trail breadcrumbs" itemprop="breadcrumb">%3$s%4$s%5$s</%1$s>',
We're removing the itemprop, so it should look like:
$breadcrumb = sprintf('<%1$s role="navigation" aria-label="%2$s" class="breadcrumb-trail breadcrumbs">%3$s%4$s%5$s</%1$s>',
Now scroll up and edit line 172:
$breadcrumb .= '<ul class="trail-items" itemscope itemtype="http://schema.org/BreadcrumbList">';
Add the itemprop here instead:
$breadcrumb .= '<ul class="trail-items" itemprop="breadcrumb" itemscope itemtype="http://schema.org/BreadcrumbList">';
The author thought you had to break them up I guess. Now when checking, it should register correctly.
回答8:
schema.org gives the following example :
<div itemprop="breadcrumb">
<a href="category/books.html">Books</a> >
<a href="category/books-literature.html">Literature & Fiction</a> >
<a href="category/books-classics">Classics</a>
</div>
Source : http://schema.org/WebPage (example section, microformat tab)
Other resource : http://www.w3.org/wiki/WebSchemas/Breadcrumbs