问题
I have the following html to structure my breadcrumbs:
<ul class="browsePageBC">
<li class="product-breadcrumb" itemscope="" itemtype="http://data-vocabulary.org/Breadcrumb"><a href="/Wanita" itemprop="url" alt="" title="Wanita"><span class="product-breadcrumb-title" itemprop="title">Wanita</span></a><span class="glyphicon glyphicon-chevron-right"></span></li>
<li class="product-breadcrumb" itemprop="child" itemtype="http://data-vocabulary.org/Breadcrumb"><a href="/Wanita/Aksesoris" itemprop="url" alt="" title="Aksesoris"><span class="product-breadcrumb-title" itemprop="title">Aksesoris </span></a></li>
</ul>
When I tested this on structured data testing tools, this is what it gives me. Wondering why it's not showing/parsing the child correctly?
回答1:
Following sample code will help you to declare the parent and child property
<div id="breadcrumb">
<span itemscope itemtype="http://data-vocabulary.org/Breadcrumb">
<a rel="home" href="http://www.example.com" itemprop="url">
<span itemprop="title">Home</span>
</a> ›
<span itemprop="child" itemscope itemtype="http://data-vocabulary.org/Breadcrumb">
<a href="http://www.example.com/topic/technology/" itemprop="url">
<span itemprop="title">Technology</span>
</a> ›
<span itemprop="child" itemscope itemtype="http://data-vocabulary.org/Breadcrumb">
<a href="http://www.example.com/tag/gadgets/" itemprop="url">
<span itemprop="title">Gadgets</span>
</a> ›
<span>Sweet Post Title Goes Here</span>
</span>
</span>
</span>
</div>
Let me know if these code help on your way.
回答2:
Google’s documentation: Rich Snippets – Breadcrumbs
You’ll see in their examples that you either
- list all entries in the correct order (without using the
child
property), or - use the
child
property in which case you would have to nest the child item under the parent item.
Note that each entry needs its own itemscope
.
来源:https://stackoverflow.com/questions/25090362/issue-with-structuring-breadcrumbs