How to Add Related Posts Below Your Blog Posts

You’ve probably been to some blogs and noticed related posts shown beneath each posts. This is definitely one of the hacks you must do on your blog. Why? It’s one of the little ways to keep your visitors busy and longer on your blog.

You first need to download this file.



Related Posts JavaScript

You should upload it to a reliable file host like opendrive.com. The one I uploaded is ok and you can use it anyway but I only suggest you should have a backup somewhere and use your own url. Like I said earlier, it’s ok to use the deault javascript in the code.

1. Login to your blogger account

2. Go to design and click on “edit html”

3. Check “expand widget template”

4. Press CTRL + F and find

</head>

5. Now, in the line before this, copy and paste the following code:

<!--RelatedPostsStarts-->

<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(&quot;http://www.gigaimage.com/images/brrl1rtaziisu0yj6kj6.gif&quot;) 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://caprio.googlecode.com/files/related_posts_for_bloggers.js' type='text/javascript'/><!--RelatedPostsStops-->

6. Now search for this code

<data:post.body/>

7. Just after this line, paste the code below

<!--RELATED-POSTS-STARTS--><b:if cond='data:blog.pageType == &quot;item&quot;'>

<div id='related-posts'>

<font face='Arial' size='3'><b>Related Posts: </b></font><font color='#FFFFFF'><b:loop values='data:post.labels' var='label'><data:label.name/><b:if cond='data:label.isLast != &quot;true&quot;'>,</b:if><b:if cond='data:blog.pageType == &quot;item&quot;'>

<script expr:src='&quot;/feeds/posts/default/-/&quot; + data:label.name + &quot;?alt=json-in-script&amp;callback=related_results_labels&amp;max-results=5&quot;' type='text/javascript'/></b:if></b:loop> </font>

<script type='text/javascript'> removeRelatedDuplicates(); printRelatedLabels();

</script></div></b:if><!--RELATED-POSTS-STOPS-->

8. Now save your template.

You should now see related posts under your blog posts.

IF YOU ARE USING A MAGAZINE STYLE TEMPLATE OR YOU’VE DONE THE “READ MORE” HACK ON YOUR TEMPLATE, YOU MIGHT HAVE MORE THAN ONE “data:post.body” IN YOUR TEMPLATE. TRY THE FIRST OR SECOND, WHICHEVER WORKS FOR YOU.

If you’re still confused about the right <data:post.body/> to use, search for this code instead:

<div class='post-footer-line post-footer-line-2'/>

Paste the code right below this.

Please note that nothing will be shown if you do not add labels to your blog posts when publishing!

avatar
Don Caprio is a full time blogger / web designer living in Nigeria and apart from blogging, my other obsession is music. I'm a self-confessed Tupac fan, an iOS lover, an Android user, a Windows 8 power user, a writer with a 5-year old unfinished novel... and the list goes on and on. You can add me on Facebook, follow my updates on Twitter or add me to your circles on ! You can as well grab my feed and get updates through email.
avatar

@doncaprio

Tech blogger at http://doncaprio.com Web designer at http://doncaprio.org
How To Minimize Android Data Consumption http://t.co/wYoJAApeWf - 52 mins ago
avatar
avatar

Get free daily updates through email

Comments

  1. avatar Computer Tips says:

    well, i will definitely make a try for RELATED POSTS. i'll comment again when i done it.
    Regards,
    Firefox Tips,Iphone Tips,Laptop Tips

  2. am going to make use of this related post for ma blog
    etisalat free downloading cheat for mobile phones

  3. avatar best Ng entertainment says:

    thanks Doncaprio for this,now i've successfully add related post widgets to this blog
    http://www.entertainmentgistme.blogspot.com
    thanks for This great post.

  4. avatar Don Caprio says:

    Glad to know it worked for you :)

  5. its works perfectly on http://www.earnonlineng.com, guy this is great.

  6. can i still make use of ur upload js…i just wanna know if its still working
    globalwalyy recently posted..What is Twitter and How Important Twitter is to your businessMy Profile

  7. THANK YOU DON COPRIO THIS IS VERY USEFUL FOR ME AND THANKS FOR SHARING THIS WITH US

  8. Thanks again For This one bro
    I uploaded My Js Instead and i used opendrive
    I even edited it
    Check it out on
    http://techdaybook.blogspot.com
    Derek recently posted..2Face Becomes a Father Again…My Profile

  9. Related post makes your readers to stay longer in your site,and also reduces bounce rate….Thanks for sharing this experience

  10. Thank for this lovely widget.
    http://nairacareer.com

  11. do you have any idea that your a legend? thanks and God bless caprio

  12. nice and good post…can you visit my blog http://teckop.blogspot.in/ i want to apply for adsense so…if you can see any errors then reply me please…thank you

  13. Quite cool and interesting. Thanks anyway.

  14. Thank you don but it is not working on my blog,any help?
    ADESANMI ADEDOTUN recently posted..How to achieve the effect of flipping 3D eBook in 3D space.My Profile

  15. @Don, this tutorial is awesome. Some bloggers would find it handy for use on their blogs. Thanks for the tut.

Speak Your Mind

*

CommentLuv badge