Breadcrumb for Blogger


Breadcrumbs or breadcrumb trail is a navigation aid used in user interfaces. It gives users a way to keep track of their location within programs or documents. The term comes from the trail of breadcrumbs left by Hansel and Gretel in the popular fairytale.

The trails like Home » Label » Post Name are the breadcrumbs.

Here is a screenshot of a Breadcrumb Trail

Breadcrumb for Blogger

Now that you know what a breadcrumb is , let us get into the details of adding the same to your Blogger Blog.

1. Go to Template > Edit HTML and  check the check box which says Expand the Widget Templates.

2. Now in the Template, Find

<b:include data='top' name='status-message'/>

and immediately above that, paste this line of code

<b:include data='posts' name='breadcrumb'/>

3. Now find

<b:includable id='main' var='top'>

If you find two occurrences of this, then locate the second one(locate the only one otherwise) and immediately above that paste this code snippet

<b:includable id='breadcrumb' var='posts'>
<b:if cond='data:blog.homepageUrl != data:blog.url'>
<b:if cond='data:blog.pageType == "static_page"'>
<div class='breadcrumbs'><span><a expr:href='data:blog.homepageUrl' rel='tag'>Home</a></span> » <span><data:blog.pageName/></span></div>
<b:else/>
<b:if cond='data:blog.pageType == "item"'>
<!-- breadcrumb for the post page -->
<b:loop values='data:posts' var='post'>
<b:if cond='data:post.labels'>
<div class='breadcrumbs' xmlns:v="http://rdf.data-vocabulary.org/#">
<span typeof="v:Breadcrumb"><a expr:href='data:blog.homepageUrl' rel="v:url" property="v:title">Home</a></span>
<b:loop values='data:post.labels' var='label'>
<b:if cond='data:label.isLast == "true"'>
 » <span typeof="v:Breadcrumb"><a expr:href='data:label.url' rel="v:url" property="v:title"><data:label.name/></a></span>
</b:if>
</b:loop>
 » <span><data:post.title/></span>
</div>
<b:else/>
<div class='breadcrumbs'><span><a expr:href='data:blog.homepageUrl' rel='tag'>Home</a></span> » <span>Unlabelled</span> » <span><data:post.title/></span></div>
</b:if>
</b:loop>
<b:else/>
<b:if cond='data:blog.pageType == "archive"'>
<!-- breadcrumb for the label archive page and search pages.. -->
<div class='breadcrumbs'>
<span><a expr:href='data:blog.homepageUrl'>Home</a></span> » <span>Archives for <data:blog.pageName/></span>
</div>
<b:else/>
<b:if cond='data:blog.pageType == "index"'>
<div class='breadcrumbs'>
<b:if cond='data:blog.pageName == ""'>
<span><a expr:href='data:blog.homepageUrl'>Home</a></span> » <span>All posts</span>
<b:else/>
<span><a expr:href='data:blog.homepageUrl'>Home</a></span> » <span>Posts filed under <data:blog.pageName/></span>
</b:if>
</div>
</b:if>
</b:if>
</b:if>
</b:if>
</b:if>
</b:includable>

This code will only display the last label of the post in the breadcrumb. If you want to display all the labels, then you will have to remove those 2 green lines of code.

4. Save the Template

5. If you want to make the breadcrumb smaller then go to Template Designer > Advanced > Add CSS and add the following Snippet there and Apply the changes

.breadcrumbs {
padding:5px 5px 5px 0px;
margin: 0px 0px 15px 0px;
font-size:95%;
line-height: 1.4em;
border-bottom:3px double #e6e4e3;
}

Now you should have a working breadcrumb navigation on your system. The original breadcrumb idea is based on Hoctro's Code from HOCTRO  breadcrumb hack. It has been modified to accommodate Search Pages, Label Pages and Archives.The post breadcrumb uses RDF breadcrumb Markup to assist you in displaying breadcrumbs in Google Search Results.

76 comments: Add Comment
pratik said...

Buddy .this post was Useful .Thanks

Rahul Jadhav said...

I am sorry for commenting here as your contact option isnt working...i want to ask a question regarding the meta tags for individual posts...if i want to add meta tags for each post then wouldnt the template become very big as i would have to add it in the head section

Sorry for commenting here...waiting for ur reply

Blogger Plugins said...

i have moved it to the appropriate post http://www.bloggerplugins.org/2008/06/meta-tags-for-blogger-blogspot.html

Joe said...

Can't get this one to work. I get the following error:

We were unable to save your template

Please correct the error below, and submit your template again.
Your template could not be parsed as it is not well-formed. Please make sure all XML elements are closed properly.
XML error message: The element type "b:widget" must be terminated by the matching end-tag "".

Strange Nature said...

Thanks again! This is a brilliant trick. Makes navigation much better.

CLEMENT SANGA said...

i like it but some how i found it a bit difficulty to install your widgets

Blogger Plugins said...

@CLEMENT SANGA what difficulty did you encounter when installing the breadcrumb widget.. let me know and i will try to help you out..

... said...

Sensational thanks!!!

Two questions:
1) how do I control the space between HOME>>and the label?

2) Can I change the >> symbol?


Again thanks this is smashing!!!

Blogger Plugins said...

@... yea offcourse you can change that replace all » in the code i have given with anything you want..

... said...

Great! Thanks for replying

So..

a) what is the exact piece of code that makes the >> symbol

b) which element in css manipulate to add space between HOME and >> and LABEL?

Thanks!

Blogger Plugins said...

check the code here .. not the one that is in blogger template now .
<b:if cond='data:label.isLast == "true"'> »
<a expr:href='data:label.url' rel='tag'><data:label.name/></a>

See the coe dont you see a >> in this..??
Similarly there are more in the code i have given in this page... First copy out this code from this page,paste it into notepad or something and then paste it into your blogger template.. Space is added by just using a space here.. No CSS is used..

.shakree. said...

thanks buddy! it works!
thanks thanks thanks!!!!
:)

Massiah said...

Thanks for this tutorial, it is great and very helpful.

Thanks
Alam
twitter.com/alamest

Mansur said...

tq for tricks..

but it is now actual breadcrumb..

The actual breadcrumb will record the travel from homepage to child pages...

but this plugin.. just show.. the hirarchy structure of entries.

Aniway.. this plugin.. is good to increase functionality of blog...

Piyush said...

how can i manage if my post have more than 1 labels ???

Piyush said...

see what i am getting here, http://www.geekblogger.org/2009/11/how-to-get-feedburner-subscribers-email.html , help me to solve this.

Blogger Plugins said...

@Piyush,
if you have multiple labels on a post, then it will use the last label only.. I believe that you modded the code and got it wrong..

@Aneesh said...

Can you tell me how can i add XML code into my blog post ??? in Blockquote Section i want to put XML Code. Help me as soon as possible.

Piyush said...

How i can add XML code in my post ?? like you have put above
example : >b:include data='top' name='status-message'/>

Bunny said...

Help, I get the following error:

We were unable to save your template

Please correct the error below, and submit your template again.
Your template could not be parsed as it is not well-formed. Please make sure all XML elements are closed properly.
XML error message: The element type "b:widget" must be terminated by the matching end-tag "".

I don't what's wrong..

Wahyu.Mw said...

thanks its very useful, especially for a newbie like me ...

..::: Munir Shah :::.. said...

thanx dear..

http://mamusoft.blogspot.com/

Zidani said...

thanks it's working .

demo : http://www.moneybuilding.co.cc/2010/03/hyifundcom.html

Hype said...

I see many SEO or Blogger Tweak Blog, no one wrote so concise, precise, clear and it works. All the plugins here is so super crisps and direct.

Ahmad Nazir said...

How do I put the breadcrumb on bottom of the post instead of on top?

Blogger Plugins said...

@Ahmad - add <b:include data='posts' name='breadcrumb'/>
below <data:post.body/>

Tonye @ True Vine Productions said...

Beautiful dude... works on my blog real nice. Thanks a lot.

Meran said...

Does anyone knows how to change the font color?

William Tell said...

Great solution works terrific however i am not getting more IE8 crashes when doing a lot of updates and QA'ing my blog any ideas?

http://williamtellstradecraft.blogspot.com

Thanks in advance.

kaizen shinobi said...

bro... its not working in my blog... kindly help me to check it out...

http://kai2en.blogspot.com

Nb said...

Thanks dude,cool hack

Gayathri said...

wow nice tut its working...thanks a lot

funaroundus.blogspot.com

Laura said...

Hi! Is there a way to show all labels not only the last one? Thanks!

Monica said...

Is there a way to show all labels? or is there any work around to show first label instead of last?

D0ct0r11 said...

Can anyone help me here? On every individual post page (the page with only one post) there's a grey line above the date and header. I've tried to get rid of it, and can't. Thanks. I've included an image. http://img43.imageshack.us/img43/9234/screenshot2nw.png

Blogger Plugins said...

@D0ct0r11 - that border was intentionally added via this line of code
border-bottom:3px double #e6e4e3;

take that off if you don't want the border.

D0ct0r11 said...

Here is the HTML code before "]]>" on my blog, .breadcrumbwrap{padding:0;width:578px;background:#FFFFFF;border:1px solid #c1c1c1}
.breadcrumbwrap ul{margin-top:0;}
#crumbs{list-style-type:none;margin:0;padding:0;height:2.3em}
#crumbs li{float:left;line-height:2.3em;color:#777;padding-left:.75em}
#crumbs li a{background:url(http://1.bp.blogspot.com/_Sd8u52mpBRQ/TD6ZdH0AJzI/AAAAAAAAATg/kIQecqvuYaw/s1600/crumbs.gif) no-repeat right center;display:block;padding:0 15px 0 0}
#crumbs li a:link,#crumbs li a:visited{color:#777;text-decoration:none}
.author_pic{width:80px;float:left;margin:0 10px 0 0}
.author_text{width:448px;float:left;margin:0}
#blog-pager {clear:both;}
]]>

Thanks if anyone can help. Please read my first comment.

Ferdinand said...

Thanks a lot. but How can I show the first label instead of last?
i tried the

data:label.isLast

I changed to

data:label.isFirst

but seems not working and the other one

data:label.isLast != "true"

but it shows all of the labels except the last. Please help me with this,,

Anas Heavencom said...

thank u :) for this important post, it works with me ;)

Cryoffalcon said...

well this was a useful tut, but i have an issue which is that no matter i do to the breadcumber css it has no effect on it,
i want to use borders for it, in inset or outset, but its not working.
Its not that i don't know css if i am not good in it but i am also not a newbie, but still i failed.
and this is not only with this breadcrumb but also with the numbered page navigation, its really weird but i am not able to find a solution.
i would really appreciate help from you, as i don't have anyone around to help me.
thanks in advance.

Enchantress said...

how can i remove this crumps from my blog, it doesnt look nice

Sam Kamal said...

thank you very much you have helped a lot. i was looking for this plugin for a long time but i did not find it cos i did not know its name "breadcrumbs"

Watchville said...

At last I have found this feature. Works great for me. Thanks.

AYUR VISTA said...

Dear sorry i can not find this



in my blog

cricist said...

Thanx!tremendous work done

ALMOSTFEAR said...

im newbie, can you tell me with picture cause i don't understand. sory my english not good :p

streaming said...

Thanks for this one! It really works guys! I used this on my site...

Hador said...

It works. But I don't really like the since this limits us to only one label in the breadcrumb. What if I want to display my labels as a hierarchy?

For example, if I have used the labels SharePoint and Fields on the same blog, then I would like to display Home > SharePoint > Fields > MyPostTitle, because I consider SharePoint to be a 'main label', and Fields to be a 'sub label' beneath SharePoint. Likewise, I might have a 'main label' called TFS, and a sub level called Work Item. These I would like to display as Home > TFS > Work Item > MyPostTitle.

Any idea how to do this?

Justin Lee said...

Thanks for this. Thank God I found this blog.
Kamsahamnisda!

Fund Managing Director said...

where to find breadcrumb?
its not visible anywhere on page?

amaanriz said...

Hey its Working ..I thought it will not worki ..but it working !!!Thnx a lot

Blog This Link said...

Breadcrumbs is nice, but is there a way to show all the labels that the post is under. Please let me know. Thanks

Saif Mobhani said...

Awesome TUT man. I just loved this one. I am a regular visitor to your blog and it is brilliant, excellent and I find mind blowing tricks over here.

Thanks a lot for this post :)

KainLaps said...

Its working. Thanks

Namakueva said...

thanks..its work..

Nam Lee said...

:( where to find breadcrumb?
its not visible anywhere on page?

Namakueva said...

help me, after i change my template and i add this breadcrumbs again, and it's not visible on my page, i can't find the breadcrumb.....please look http://namakueva.blogspot.com, thanks

Tech n Stuffs said...

Thank you so much for this! It works perfectly!

Anonymous said...

how to disable breadcrumbs on particular page (particular label)
i.e. i don't want breadcrumbs link to be shown on certain label/pages

tnx!

Marco said...

Thanks. I tried it on my blog and it looks really nice but the hiperlinks dont work, could you please help? Thanks
http://path2yoga.blogspot.com/

trueinternetworld said...

it seems this hack doesnt work on all blogger template, i have tried this over and over again but it isnt working http://www.trueinternetworld.com

market info said...

Thanks. I tried it on my blog and it looks really nice but the hiperlinks dont work, could you please help? Thanks

http://sharemarkettipsfree.blogspot.com/

Laxmi media services said...

showing no errors but not appearing on blog??

Rabindra Lamsal said...

When I share my blog posts in Facebook then in the description this comes:

"You are Here:....and so on"

Can anyone help me...I want to post snippet in the description. Hepl me please.

Hetal Patil Rawat said...

I successfully added snippets but it is not showing up in my blog: Download Shirdi Sai Baba Bhajans Mp3 Artis...

Premium For You All said...

thanks

Blogger Plugins said...

@Hetal Patil Rawat - In step 3, you must have seen two occurrences of that line. Try pasting above the one which you haven't already tried, and it should come up.

Lică Nemeș said...

I can not locate the second (then locate the second one).

Blogger Plugins said...

@Lică - then paste it above the first one.

Hyderabadi said...

@Blogger Plugins, I have been following this code from many blogs. but I got the error as:
"The widget with id "Blog1" cannot contain element: "#comment". A widget can only contain b:includable elements."
Do you have any solution for this?

Hyderabadi said...

@Blogger Plugins, another interesting thing for which I have been trying is ... to show the related month archive link in the breadcrumb navigation for a particular post.
for example ... if there is a post (named as "Breadcrumb navigation") with label "tutorials" in december-2011, then the breadcrumb navigation above this post should show like this:
Home » 2012/12 » Tutorials » Breadcrumb navigation
I think we can get the month archive name of the post as [data:post.dateHeader/] & then thru javascript we can split the year and month and can even specify the URL to the particular month. Is it possible?

Ray said...

Thank you...this was very useful,

Film Mediafire said...

Hai dude can i change the colours..??

Bhavesh said...

Thanks, It worked on one of my blogspot blog.

Embdesigntube said...

Thanks for the post.
It worked for me and I am really thankful to you for the awesome trick.

ColdFireGFX said...

Wow! very informative post, thank you very much

Post a Comment