What semantic HTML markup should be used to create breadcrumbs? - html

What meaningful HTML tag should be used to create breadcrumbs? I have a menu bar which is created using unsorted list since it is a list:
<ul id="navigation">
<li><%= Html.ActionLink("Home", "Index", "Home") %></li>
<li><%= Html.ActionLink("Contacts", "Index", "Contacts") %></li>
</ul>
Now, I decided to put a breadcrumbs below the menu, the problem is, I don't know what tag should I use. As much as possible, I want to use meaningful tags. Please help me...

There's plenty of ways of marking up breadcrumbs. A list is fine. An ordered list is more appropriate for breadcrumbs because it is a list of links in a particular order.
If you don't want to use a list, you could instead leave them as a set of links in a div. Although if you're using HTML5, you may want to put them in a nav element.
Finally, the HTML5 spec suggests using a p element because they could be read as a paragraph of direction on how to get to the particular page.

Old post but came up high in a search and I think things have changed a bit since this question was originally asked.
In a html5 site I would use the nav tag as breadcrumbs are technically navigation through the site. If you want to make it even more clear what they are you can add microdata to state that they are breadcrumbs.
From Googles example and html5doctor
<nav>
<ul>
<li itemscope itemtype="http://data-vocabulary.org/Breadcrumb">
<a href="http://www.example.com/dresses" itemprop="url">
<span itemprop="title">Dresses</span>
</a>
</li>
<li itemscope itemtype="http://data-vocabulary.org/Breadcrumb">
<a href="http://www.example.com/dresses/real" itemprop="url">
<span itemprop="title">Real Dresses</span>
</a>
</li>
<li itemscope itemtype="http://data-vocabulary.org/Breadcrumb">
<a href="http://www.example.com/clothes/dresses/real/green" itemprop="url">
<span itemprop="title">Real Green Dresses</span>
</a>
</li>
</ul>

If you don't want to use an ordered list or paragraph tags, you could always use a nested list to semantically represent the hierarchical nature of the breadcrumbs.
The following example comes from Mark Newhouse's A List Apart article entitled "CSS Design: Taming Lists."
<div id="bread">
<ul>
<li class="first">Home
<ul>
<li>» Products
<ul>
<li>» Computers
<ul>
<li>» Software</li>
</ul>
</li>
</ul></li>
</ul></li>
</ul>
</div>

Using an unordered list for your breadcrumbs seems perfectly reasonable to me; there isn't always a named tag for every application specific structure and you are displaying a list of breadcrumbs afterall.
You can use css to make the bread crumbs display the way you would like.

to create breadcrumb you can use following ways: (you should use nav as wrapper to tell bots there's some internal links, if you're using html5)
Matthew Rankin's answer describes this one.
second way using ol list instead of first way like below to tell bot there's an order between items:
<nav>
<ol class="breadcrumb">
<li>Top Level</li>
<li>Second Level</li>
<li>Third Level</li>
<li>Current Item</li>
</ol>
</nav>
third way is using p tag and rel up for links(rel up is not final!)
<nav>
<p>
Main >
Products >
Dishwashers >
<a>Second hand</a>
</p>
</nav>

Quick 2021 update:
RFDa:
<ol vocab="https://schema.org/" typeof="BreadcrumbList">
<li property="itemListElement" typeof="ListItem">
<a property="item" typeof="WebPage" href="https://example.com/dresses">
<span property="name">Dresses</span></a>
<meta property="position" content="1">
</li>
<li property="itemListElement" typeof="ListItem">
<a property="item" typeof="WebPage" href="https://example.com/dresses/real">
<span property="name">Real Dresses</span></a>
<meta property="position" content="2">
</li>
</ol>
Microdata:
<ol itemscope itemtype="https://schema.org/BreadcrumbList">
<li itemprop="itemListElement" itemscope
itemtype="https://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="https://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>
This examples are taken from https://schema.org/BreadcrumbList
As stated on http://data-vocabulary.org:
Since June 2011, several major search engines have been collaborating on a new common data vocabulary called Schema.org

always checkout Jacob Nielsen: He has recommended the ">" since 2003.

Take a look at: https://www.w3.org/TR/wai-aria-practices/examples/breadcrumb/index.html
You can combine with schema.org ( suggested by #SCabralO ) if wanted but keep the attributes from this example. Make it perfect but simple ;)

Related

How do I get subfolders to show in a dropdown?

I'm just learning html to build a team site at work. I'm getting the hang of it pretty easily, but I'm having an issue with subfolders not showing in a dropdown. The html is linked to css for a design, but I know the problem isn't with the css.
I'm not exactly sure what to try as I mentioned I am just learning how to code the html.
<li class="top"><span class="down">Folders</span>
<ul class="hsolinks">
<li><span class="down">HIPAA Security Office</span></li>
<ul class="hsolinks">
<li>Access</li>
<li>Audit</li>
<li>LAN File Access</li>
<li>Training</li>
</ul>
The expected result is that the folders "ACCESS", "AUDIT", "LAN FILE ACCESS", and "TRAINING" would show under the HIPAA Security Office in a css dropdown. However, when I place the code into SharePoint it only shows an arrow, but no folders in the dropdown under HIPAA Security Office.
Also, there is additional code under this which is why I have only closed one ul tag. I hope I'm clear with what I'm trying to do!
The <li> element always needs to be surrounded by a <ul> element. But you can have a <ul> inside an <li> if needed. Something like so will work
<ul>
<li class="top">
<a href="#nogo4" id="hsolinks" class="top_link">
<span class="down">Folders</span>
</a>
<ul class="hsolinks">
<li>
<a href="#" target="_parent" class="hsolinksfly">
<span class="down">HIPAA Security Office</span>
</a>
<ul class="hsolinks">
<li>
Access
</li>
<li>
Audit
</li>
<li>
LAN File Access
</li>
<li>
Training
</li>
</ul>
</li>
</ul>
</li>
</ul>
For more information and examples about the <ul> <li> elements read: ul: The Unordered List element

Use of SiteNavigationElement and BreadcrumbList together

I am working on my following SEO-friendly navigation:
<nav itemprop="breadcrumb" itemscope itemtype="https://schema.org/BreadcrumbList">
<ul id="hornavmenu" class="nav navbar-nav">
<li itemprop="itemListElement" itemscope itemtype="http://schema.org/ListItem" >
<span itemprop="name">Start</span>
</li>
<li itemprop="itemListElement" itemscope itemtype="http://schema.org/ListItem" >
<span itemprop="name">About</span>
</li>
<li itemprop="itemListElement" itemscope itemtype="http://schema.org/ListItem" >
<span itemprop="name">Contact</span>
</li>
</ul>
</nav>
So the problem is, that in Google Search the Breadcrumblist looks like this:
URL -> Start -> About -> Contact
Of course that's wrong, but what is wrong in the code? Additionally, I would like to add:
<nav itemscope="itemscope" itemtype="http://www.schema.org/SiteNavigationElement">
…
</nav>
…but where do I add the BreadcrumbList and how do I merge these two?
Google doesn't encourage the inclusion of a ‘home’ link in the breadcrumb list, as shown on Google's Breadcrumbs page where all examples omit a home point. Breadcrumbs are not for primary navigation and you should have a sufficient link to root elsewhere.
In my experience with using BreadcrumbList, Google does omit the ‘home’ link from breadcrumbs in the SERPs when the link points to the domain. In this case, you're using ‘index.html’ which could be a different page to ‘example.com’.
SiteNavigationElement is used to indicate the primary navigation for the site. As mentioned breadcrumbs are not this. Use SiteNavigationElement for your actual navigation. For more details, see What is the correct use of schema.org SiteNavigationElement?.
The BreadcrumbList type is for breadcrumbs. Don’t use it for something else.
In your case, it seems to be a navigation menu. The SiteNavigationElement type can be used for these. It could look like:
<nav itemscope itemtype="http://schema.org/SiteNavigationElement">
<ul>
<li>Start</li>
<li>About</li>
<li>Contact</li>
</ul>
</nav>
As you can see, it’s for the whole navigation, not for single navigation links. So don’t use name or url for the links.
If you want to provide structured data about each linked page, you could use ItemList together with SiteNavigationElement. This would be similar to your BreadcrumbList example.
NB: I recommend not to use SiteNavigationElement at all, unless you have a specific use case or consumer in mind (in which case you should follow their documentation).

Can't get google to display breadcrumb in search results

I'm trying to get Google to show my breadcrumb in search results by using schema.org's breadcrumb micro data. When I use Google's structured data testing tool, the breadcrumb doesn't show in the search results sample and the following message appears: "The excerpt from the page will show up here. The reason we can't show text from your webpage is because the text depends on the query the user types."
I don't understand that because the URL I'm using doesn't contain a query string (it's http://www.fastfoodnutrition.org/6_r-taco-bell/8511_i-sausage-flatbread-melt-nutrition-facts.html)
Here's my code:
<ol class="breadcrumb" itemscope itemtype="http://schema.org/breadcrumb">
<li><a itemprop="url" href="/6_r-taco-bell/nutrition-facts.html" title="/6_r-taco-bell/nutrition-facts.html"><span itemprop="title">Taco Bell</span></a></li>
<li><a itemprop="url" href="/6_r-taco-bell/269_c-breakfast-nutrition-facts.html" title="/6_r-taco-bell/269_c-breakfast-nutrition-facts.html"><span itemprop="title">Breakfast</span></a></li>
<li>Sausage Flatbread Melt Nutrition Facts</li>
</ol>
Google doesn't recognize them yet, you should use http://data-vocabulary.org/Breadcrumb instead and it will be recognized by the RichSnippets tool as this Google post suggest. So your code would be:
<ol>
<li itemscope itemtype="http://data-vocabulary.org/Breadcrumb">
<a itemprop="url" href="/6_r-taco-bell/nutrition-facts.html" title="/6_r-taco-bell/nutrition-facts.html">
<span itemprop="title">Taco Bell</span>
</a>
</li>
<li itemscope itemtype="http://data-vocabulary.org/Breadcrumb">
<a itemprop="url" href="/6_r-taco-bell/269_c-breakfast-nutrition-facts.html" title="/6_r-taco-bell/269_c-breakfast-nutrition-facts.html">
<span itemprop="title">Breakfast</span>
</a>
</li>
<li itemscope itemtype="http://data-vocabulary.org/Breadcrumb">
<span itemprop="title">Sausage Flatbread Melt Nutrition Facts</span>
</li>
</ol>

Microdata on list markup not validating with W3C validator

I am brand new to Microdata and I am slowly getting it. But for some reason this does not validate with the W3C validator since I’m putting a <div> in the middle of a <ul>:
<div itemscope itemtype="http://schema.org/BeautySalon">
<ul>
<li>
<b>
<span itemprop="name">foobar and you</span>
</b>
</li>
<div itemprop="address" itemscope itemtype="http://schema.org/PostalAddress">
<li>
<span itemprop="streetAddress">6969 foobar</span>
</li>
<li>
<span itemprop="addressLocality">Miami Beach</span>,
<span itemprop="addressRegion">FL</span>
<span itemprop="postalCode">33139</span>
</li>
</div>
<li>
<span itemprop="telephone">305 691 6969</span>
</li>
</ul>
</div>
How would I correctly add the
<div itemprop="address" itemscope itemtype="http://schema.org/PostalAddress">
and correctly add all the itemprop and still be W3C valid?
ul doesn’t allow div as child, so you can’t use it as container for several li elements. There are various possible solutions.
I think using ul here is not appropriate. But if you want to keep using ul:
It doesn’t seem to make sense that the street address is not in the same list item as the locality/region/postal code. So you might want to put them all in the same list item (and you might also want to use br for postal addresses).
If you want to use b for the name, you could omit the span. Either specify the Microdata on the b or (for consistency) on the li.
If you don’t need a separate element for the telephone number, you could specify the Microdata on the li.
This would give you:
<div itemscope itemtype="http://schema.org/BeautySalon">
<ul>
<li itemprop="name"><b>foobar and you</b></li>
<li itemprop="address" itemscope itemtype="http://schema.org/PostalAddress">
<span itemprop="streetAddress">6969 foobar</span><br>
<span itemprop="addressLocality">Miami Beach</span>,
<span itemprop="addressRegion">FL</span><br>
<span itemprop="postalCode">33139</span>
</li>
<li itemprop="telephone">305 691 6969</li>
</ul>
</div>
You can use every HTML5 element for Microdata. Re-use your existing markup. Only if you need additional elements for Microdata, add and use div/span (and possibly meta/link).

What is the correct use of schema.org SiteNavigationElement?

In SEO terms...
Is it best to put the scheme on the parent containing all the links?
<nav itemscope="itemscope" itemtype="http://www.schema.org/SiteNavigationElement">
Link 1
Link 2
Link 3
</nav>
...or should each link be considered as it's own element?
<nav>
<span itemscope="itemscope" itemtype="http://www.schema.org/SiteNavigationElement">
<a itemprop="url" href="#">
<span itemprop="name">Link 1</span>
</a>
</span>
<span itemscope="itemscope" itemtype="http://www.schema.org/SiteNavigationElement">
<a itemprop="url" href="#">
<span itemprop="name">Link 2</span>
</a>
</span>
<span itemscope="itemscope" itemtype="http://www.schema.org/SiteNavigationElement">
<a itemprop="url" href="#">
<span itemprop="name">Link 3</span>
</a>
</span>
</nav>
If SiteNavigationElement is meant for the whole navigation (i.e., a navigation link list), your first example is correct.
If SiteNavigationElement is meant for a single navigation entry (i.e., a link in the navigation link list), your second example is correct.
I think Schema.org doesn’t unambiguously define which variant is meant, as they only say:
A navigation element of the page.
However, the parent type WebPageElement is defined as:
A web page element, like a table or an image
Also, all the other child types (like Table or WPFooter) seem to be used for the whole thing, and not specific parts of the thing.
So this seems to suggest that the whole navigation should be marked up, and not each single link:
<nav itemscope itemtype="http://schema.org/SiteNavigationElement">
<ul>
<li>Link 1</li> <!-- don’t use the 'url' or 'name' property here! -->
<li>Link 2</li>
</ul>
</nav>
In this case, all the properties belong to the whole navigation, so that means the url property would specify a URL for this navigation (and not the URLs of the links in this navigation!).
According to Search Engine Land, it's supposed to look like this:
<ul itemscope itemtype="http://www.schema.org/SiteNavigationElement">
<li itemprop="name">
<a itemprop="url" href="#">Link 1</a>
</li>
<li itemprop="name">
<a itemprop="url" href="#">Link 2</a>
</li>
<li itemprop="name">
<a itemprop="url" href="#">Travel Resources</a>
</li>
</ul>
First answer is correct but I'd mix both for (HTML5-)semantic:
<nav itemscope itemtype="http://schema.org/SiteNavigationElement">
<ul>
<li>
<a itemprop="url" href="http://example.com/">
<span itemprop="name">Link 1</span>
</a>
</li>
</ul>
</nav>
<nav role="navigation">
<ul role="menubar" aria-activedescendant="">
<li role="presentation" itemscope itemtype="https://schema.org/SiteNavigationElement">
<a href="" role="menuitem" tabindex="-1" itemprop="url">
<span itemprop="name">Link 1</span>
</a>
</li>
</ul>
</nav>
schema.org/SiteNavigationElement extends WebPageElement and can be used to mark-up links, which would often make good contextual links. You can use this schema for your page menu.
<nav role="navigation" itemscope itemtype="http://schema.org/SiteNavigationElement">
<ul>
<li>
<a href="https://yoursite.com/" title="Link to Home" itemprop="url">
<span itemprop="name">Home</span>
</a>
</li>
<li>
<a href="https://yoursite.com/sample-page" title="Link to sample page" itemprop="url">
<span itemprop="name">sample page</span>
</a>
</li>
</ul>
OP's original question contained a good example of code. none of the answers do though ...
It seems everyone threw in a somewhat random answer ... You can test your schema microdata code using the following official google tool search.google.com/structured-data/testing-tool.
If you run the proposed answers in this tool you will notice that none give you the expected result: a list of SiteNavigationElement with a name & url
Some might argue that a whole menu might be considered a "navigation element" but I think it makes more sense for this denomination to designate a single navigation link. Plus if we use the SiteNavigationElement as a marker for the whole menu we have no way of associating names with URLs in the html.
To achieve this, you need to have each link be encapsulated by an itemscope property and they all need to have their own name and url itemprop (these are singleton as mentioned by #David Harkness, so they have to appear only once per itemprop)
<nav>
<ul>
<li itemscope itemtype="http://schema.org/SiteNavigationElement">
<a itemprop="url" href="http://example.com/link-1">
<span itemprop="name">Link 1</span>
</a>
</li>
<li itemscope itemtype="http://schema.org/SiteNavigationElement">
<a itemprop="url" href="http://example.com/link-2">
<span itemprop="name">Link 2</span>
</a>
</li>
</ul>
</nav>
The code above will yeld two different navigation elements, each with a name and an URL.
Note: the itemprop="url" attribute uses the anchor's href attribute as value
Consider the following code snippet adapted from the page source of habd.as:
<nav itemscope itemtype="https://schema.org/SiteNavigationElement">
<meta itemprop="name" content="Main Menu">
<a itemprop="url" class="active" href="/">habd.as</a>
<a itemprop="url" href="/code/">Code</a>
<a itemprop="url" href="/post/">Posts</a>
<a itemprop="url" href="/site/">Sites</a>
<a itemprop="url" href="/talk/">Talks</a>
</nav>
<nav itemscope itemtype="https://schema.org/SiteNavigationElement">
<meta itemprop="name" content="Utility Menu">
<a itemprop="url" href="/about/">About</a>
<a itemprop="url" href="/contact/">Contact</a>
</nav>
When there are multiple navigations as shown above, use of SiteNavigationElement to group navigation items affords the use of name
such that the grouping itself may be labeled. Labels for individual items within the groups can be obtained using the content of the links themselves.
Therefore, your first example is more correct despite assertions to the contrary.
I think the most elegent solution would be to use the hasPart property.
<nav itemscope="itemscope" itemtype="http://www.schema.org/SiteNavigationElement">
<a itemprop="hasPart" href="/link1.html">Link 1</a>
<a itemprop="hasPart" href="/link2.html">Link 2</a>
<a itemprop="hasPart" href="/link3.html">Link 3</a>
</nav>
Using Google's Structure Data Testing Tool informs that these links are part of the SiteNavigationElement and that Google should follow the links to those items:
Having considered all the above, I came to the following conclusion:
<nav itemscope itemtype="http://schema.org/SiteNavigationElement">
<ul>
<li itemprop="hasPart">
<span itemprop="name">Home</span>
</li>
</nav>
Thus, each <li> is part of the SiteNavigationElement that has the url and name. I think this is the best option.
But do search engines need such redundant markup? They already know that href in is the url, and inside the tag <a>name is the name. What do you think about it?
Here's a quote from a post at Google support site, saying:
We are contemplating to implement Site Navigation Schema
https://schema.org/SiteNavigationElement
Will google respect it and display sitelinks if the schema is there or it will do it own thing anyway?
I sthere a point at all?
This type of top-level does not currently support Google. In fact,
this type does not even have a scope definition. It is unclear whether
this type affects a group, for example, a navigation menu, or only one
link.
This confirms my experience with their rich results test: only breadcrumbs are recognized. Yandex validates my microdata just fine. So SiteNavigationElement on your page seems to be as useless as it is valid.