Sunday, July 18, 2010

how to add related posts on Blogger

we have seen on most of the blogger site , "Related post" section is there after every post now you want to add this Related post / Similar post on your blog ? follow the below easy steps and configure you blogger accordingly.

  • Open blogger.com site

  • Go to Design section under that you will get Edit Html Tab just click on it.

  • now before making any changes on your xml file just take abackup for safty

  • just click on "Expand widget templates "

  • Add the below code above the </head > section or better way is search the keyword </head>

    <script src='https://www.opendrive.com/files/6673148_cnSMd/RelatedPosts_Blogger.js' type='text/javascript'/>


  • now search for code <data:post.body/>

  • After this paste the below code line



  • <b:if cond='data:blog.pageType == "item"'>
    <div id='related-posts'>
    <font face='Arial' size='3'><b>Related Posts: </b></font><font color='#000000'><b:loop values='data:post.labels' var='label'><data:label.name/><b:if cond='data:label.isLast != "true"'>,</b:if><b:if cond='data:blog.pageType == "item"'>
    <script expr:src='"/feeds/posts/default/-/" + data:label.name + "?alt=json-in-script&callback=related_results_labels&max-results=5"' type='text/javascript'/></b:if></b:loop> </font>
    <script type='text/javascript'> removeRelatedDuplicates(); printRelatedLabels();
    </script></div></b:if>



  • now on the above code you will see the red section line "max-results=xx" here you can enter no of post you want to see on your page
    accordingly you can mention it.

  • now save you template and see the magic on your post

  • you will see the number of post after each article , before that you need to add label on your post. hope you like it


  • if you face any problem while doing this plz leave a comment.