Just follow the instructions below to add “Related Post” widget in Blogger.
STEP 1:
Log in to Blogger, go to Layout -> Edit HTML
And mark the tick-box “Expand Widget Templates“
Now find this in the template :
</head>
And immediately ABOVE/BEFORE it, paste this code:
<style>
#related-posts {
float : left;
width : 540px;
margin-top:20px;
margin-left : 5px;
margin-bottom:20px;
font : 11px Verdana;
margin-bottom:10px;
}
#related-posts .widget {
list-style-type : none;
margin : 5px 0 5px 0;
padding : 0;
}
#related-posts .widget h2, #related-posts h2 {
color : #940f04;
font-size : 20px;
font-weight : normal;
margin : 5px 7px 0;
padding : 0 0 5px;
}
#related-posts a {
color : #054474;
font-size : 11px;
text-decoration : none;
}
#related-posts a:hover {
color : #054474;
text-decoration : none;
}
#related-posts ul {
border : medium none;
margin : 10px;
padding : 0;
}
#related-posts ul li {
display : block;
background : url("http://i44.tinypic.com/2eduj53.jpg") no-repeat 0 0;
margin : 0;
padding-top : 0;
padding-right : 0;
padding-bottom : 1px;
padding-left : 16px;
margin-bottom : 5px;
line-height : 2em;
border-bottom:1px dotted #cccccc;
}
</style>
<script src='http://www.yourjavascript.com/0185072301/Post.js' type='text/javascript'/>
Now save your Template.
Now find the next line in the code
<p><data:post.body/></p>
And immediately BELOW/AFTER it, paste this code:
<b:if cond='data:blog.pageType == "item"'>
<div id='related-posts'>
<h2>You might also like: <b:loop values='data:post.labels' var='label'>
<script expr:src='"/feeds/posts/default/-/" + data:label.name + "?alt=json-in-script&callback=related_results_labels&max-results=5"' type='text/javascript'/></b:loop> </h2>
<script type='text/javascript'> removeRelatedDuplicates(); printRelatedLabels(); </script>
</div></b:if>
Save your template and you are done with two step installation of code.
If you have any problem please use comments form below.












