Breadcrumb for Blogger / Blogspot


All of us might have seen breadcrumbs on most wordpress blog.
So why not implement a breadcrumb for the blogger blogs.. For those who don't know what a breadcrumb is,here is a little defenition from wikipedia.
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.
So lets get into the details of implementing a breadcrumb navigation for blogger.
Goto your blogger Layout > Edit Html.
Backup your template and choose to Expand the Widget templates.

Now Find this piece of code.
<b:include data='top' name='status-message'/>

Now replace that with
<b:include data='top' name='status-message'/>
<b:include data='posts' name='breadcrumb'/>

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

and replace it with
<b:includable id='breadcrumb' var='posts'>
<b:if cond='data:blog.homepageUrl == data:blog.url'>
<!-- No breadcrumb on home page -->
<b:else/>
<b:if cond='data:blog.pageType == "item"'>
<!-- breadcrumb for the post page -->
<p class='breadcrumbs'>
<span class='post-labels'>
<a expr:href='data:blog.homepageUrl' rel='tag'>Home</a>
<b:loop values='data:posts' var='post'>
<b:if cond='data:post.labels'>
<b:loop values='data:post.labels' var='label'>
<b:if cond='data:label.isLast == "true"'> »
<a expr:href='data:label.url' rel='tag'><data:label.name/></a>
</b:if>
</b:loop>
<b:else/>
»Unlabelled
</b:if>
» <span><data:post.title/></span>
</b:loop>
</span>
</p>
<b:else/>
<b:if cond='data:blog.pageType == "archive"'>
<!-- breadcrumb for the label archive page and search pages.. -->
<p class='breadcrumbs'>
<span class='post-labels'>
<a expr:href='data:blog.homepageUrl'>Home</a> » Archives for <data:blog.pageName/>
</span>
</p>
<b:else/>
<b:if cond='data:blog.pageType == "index"'>
<p class='breadcrumbs'>
<span class='post-labels'>
<b:if cond='data:blog.pageName == ""'>
<a expr:href='data:blog.homepageUrl'>Home</a> » All posts
<b:else/>
<a expr:href='data:blog.homepageUrl'>Home</a> » Posts filed under <data:blog.pageName/>
</b:if>
</span>
</p>
</b:if>
</b:if>
</b:if>
</b:if>
</b:includable>
<b:includable id='main' var='top'>

Now find
]]></b:skin>

and replace it with
.breadcrumbs {
padding:5px 5px 5px 0px;
margin: 0px 0px 15px 0px;
font-size:95%;
line-height: 1.4em;
border-bottom:3px double #e6e4e3;
}
]]></b:skin>

Now you should have a working breadcrumb navigation on your system


Here I have modified the hoctro breadcrumb hack to include search pages,labels and archives.and those posts without a label will be shown as unlabelled..
37 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

Aneesh 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

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

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

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

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

Aneesh 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

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

Post a Comment

Please don't spam on here..