7 Jul 2011

Add breadcrumb navigation system to your blog

If there is one image you should see to know what a breadcrumb is then its this:


                                  Home >> Label >> Post Name
                                 
                                             
Now most of you must have figured out what it is. This is a simple way to know where exactly you are in a particular site or a blog.Now here's how to add it

TIP: for all posts regarding EDITING HTML make sure that you have a downloaded copy of your template with you just in case anything goes wrong.

  1. Sign in and find DESIGN tab and in turn find EDIT HTML and check on expand widget templates.
  2. Search for  <b:include data='top' name='status-message'/> and replace it with

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



     3. Now search for  <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'>


  4. search for ]]></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>

  5.   Save your changes and at last it's done.