Saturday, August 8, 2009

How to add breadcrumbs to your posts

breadcrumbposticon From this tutorial, you will be able to add breadcrumbs navigation to your posts. Having breadcrumbs on your blog will make it easier for your readers to navigate through your page without having to re-search something they might’ve found useful while reading but went ahead and navigated away, planning to come back to it later. Breadcrumbs will provide a route back so your readers won’t get lost while reading and also show their current location.

Steps to follow:

1. Login to your Blogger dashboard

2. Go to Layout > Edit HTML (Click on “expand widgets” box)

3. Search for the following section code: ]]></b:skin>
and add the following section code below right before it:

.breadcrumbs {
float: left;
width: 100%;
font-size: 11px;
margin: 10px 0px 10px 0px;
padding: 0px 0px 3px 0px;
border-bottom: double #EAEAEA;
}

Note: You can modify the appearance of your breadcrumbs using the section code above after you have completed this tutorial.

4. Next, you will need to search for the following section code below:

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

5. Replace the entire section code with the following section code below:

<b:includable id='main' var='top'>
<!-- posts -->
<div class='blog-posts hfeed'>
<b:include data='top' name='status-message'/>
<data:adStart/>

with…

<b:includable id='main' var='top'>
<!-- posts -->
<div class='blog-posts hfeed'>
<!-- disable default status message<b:include data='top' name='status-message'/>default status message disabled -->
<b:include data='posts' name='breadcrumb'/><data:adStart/>

6. Now immediately before the section code:

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

copy and paste the following section code:

<b:includable id='breadcrumb' var='posts'>
<b:if cond='data:blog.homepageUrl == data:blog.url'>
<!-- No breadcrumb on front page -->
<b:else/>
<b:if cond='data:blog.pageType == "item"'>
<div class='breadcrumbs'>
Browse » <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>
» <span><data:post.title/></span> </b:if> </b:loop> </div>
<b:else/>
<b:if cond='data:blog.pageType == "archive"'>
<div class='breadcrumbs'>
Browse » <a expr:href='data:blog.homepageUrl'>Home</a> » Archives for <data:blog.pageName/> </div> <b:else/>
<b:if cond='data:blog.pageType == "index"'>
<div class='breadcrumbs'>
<b:if cond='data:blog.pageName == ""'>
Browse » <a expr:href='data:blog.homepageUrl'>Home</a> » All posts <b:else/>
Browse » <a expr:href='data:blog.homepageUrl'>Home</a> »
Posts filed under <data:blog.pageName/>
</b:if> </div> </b:if> </b:if> </b:if>
</b:if></b:includable>

7. Next, Preview you template, and if all is working fine, Save Template and your done!

No comments:

Post a Comment