How To Add Related Posts Widget in Blogger Blogs

Method 1:

The related posts widget will display a latest related posts segment below your blog post. The related posts widget collects the related posts from those blog posts having the equivalent label as the present post.

To execute the related posts widget you will have to go with following easy understudy steps.


Step 2: Find following code,


And exactly below this, paste following code
<style> #related-posts{float:left;width:570px;margin:20px 20px 20px 0px;}#related-posts .widget{list-style-type:none;margin:5px 0;padding:0;}#related-posts .widget h2,#related-posts h2{color:#940f04;font-size:20px;font-weight:400;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{margin:10px;padding:0;}#related-posts ul li{display:block;background:url(&quot;;) no-repeat 0 0;line-height:2em;border-bottom:1px dotted #ccc;margin:0 0 5px;padding:0 0 1px 22px;}</style>
570px : you may change this according to your post content size.

Step 3: Find following code,


And exactly below this, paste following code

<b:if cond='data:blog.pageType == &quot;item&quot;'> <div id='related-posts'><div style='background-color: none; background: url( 0 0 repeat-x; font-size: 13px; padding: 10px; border: 1px solid #CCC; border: 1px solid rgba(0, 0, 0, .15); margin: 0 0 1em; max-height: 36px; -webkit-border-radius: 3px; -moz-border-radius: 3px; border-radius: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; position: relative; line-height: 14px;'><b>See other Posts on <b:loop values='data:post.labels' var='label'><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; + + &quot;?alt=json-in-script&amp;callback=related_results_labels&amp;max-results=5&quot;' type='text/javascript'/></b:if></b:loop></b></div><script type='text/javascript'> removeRelatedDuplicates(); printRelatedLabels();</script> </div></b:if>

5: You may change this number for showing total number of post titles in this widget.

You may paste this code according to your requirement of blog template; below post or title.

Step 4: Save Template.

Method 2:

We can add related posts plugin to your blogger blog in two methods. Let me guide you with those two methods one by one. But remember to take a backup of your existing template before editing and adding related posts widget.

   1. Log in to your blogger Dashboard.
   2. Navigate to your blog’s Layout >> Edit HTML
   3. Expand your widget by clicking on Expand widget templates
   4. Find the following code in your template. (Press Ctrl+F to make a search)


   5. Now paste the following code just below the above code.

          <b:if cond=’data:blog.pageType == “item”‘>
          <div class=’similiar’>
          <!– **********************Jan,2007****************** –>
          <!– *****************Related Articles by Labels – Take Two****************** –>


          1. Now, users don’t need to change anything to use this widget. just copy and paste, and done!
          2. The current article will also be listed, now it’s no more.

          <div class=’widget-content’>
          <h3>Related Posts by Categories</h3>
          <div id=’data2007′/><br/>
          <div id=’SolidBlogger’>
          Related Posts Widget by <u><a href=’’>SolidBlogger</a></u>
          <script type=’text/javascript’>

          var homeUrl3 = &quot;<data:blog.homepageUrl/>&quot;;
          var maxNumberOfPostsPerLabel = 4;
          var maxNumberOfLabels = 10;

          maxNumberOfPostsPerLabel = 5;
          maxNumberOfLabels = 3;

          function listEntries10(json) {
          var ul = document.createElement(&#39;ul&#39;);
          var maxPosts = (json.feed.entry.length &lt;= maxNumberOfPostsPerLabel) ?
          json.feed.entry.length : maxNumberOfPostsPerLabel;
          for (var i = 0; i &lt; maxPosts; i++) {
          var entry = json.feed.entry[i];
          var alturl;

          for (var k = 0; k &lt;; k++) {
          if ([k].rel == &#39;alternate&#39;) {
          alturl =[k].href;
          var li = document.createElement(&#39;li&#39;);
          var a = document.createElement(&#39;a&#39;);
          a.href = alturl;

          if(a.href!=location.href) {
          var txt = document.createTextNode(entry.title.$t);
          for (var l = 0; l &lt;; l++) {
          if ([l].rel == &#39;alternate&#39;) {
          var raw =[l].href;
          var label = raw.substr(homeUrl3.length+13);
          var k;
          for (k=0; k&lt;20; k++) label = label.replace(&quot;%20&quot;, &quot; &quot;);
          var txt = document.createTextNode(label);
          var h = document.createElement(&#39;b&#39;);
          var div1 = document.createElement(&#39;div&#39;);
          function search10(query, label) {

          var script = document.createElement(&#39;script&#39;);
          script.setAttribute(&#39;src&#39;, query + &#39;feeds/posts/default/-/&#39;
          + label +
          script.setAttribute(&#39;type&#39;, &#39;text/javascript&#39;);

          var labelArray = new Array();
          var numLabel = 0;

          <b:loop values=’data:posts’ var=’post’>
          <b:loop values=’data:post.labels’ var=’label’>
          textLabel = &quot;<>&quot;;

          var test = 0;
          for (var i = 0; i &lt; labelArray.length; i++)
          if (labelArray[i] == textLabel) test = 1;
          if (test == 0) {
          var maxLabels = (labelArray.length &lt;= maxNumberOfLabels) ?
          labelArray.length : maxNumberOfLabels;
          if (numLabel &lt; maxLabels) {
          search10(homeUrl3, textLabel);


   6. Check out the below screenshot for the correct implementation of the code.

   7. Save your template to see that you have just added the related posts plugin to your blogger blog.
   8. You are done.

Method 3:

Unlike the above manual method, second method allows you to add related posts widget with a single click. Follow the below steps.
  1. Click on the below button.
   2. Select the blog in which you want to install this widget.
   3. Give a proper title to this widget. You may want to name it as “Related Posts“.
   4. Click on Add Widget to get this widget added to your blogger blog’s sidebar.
   5. You can change this widget’s location by placing it just below the blog post‘s widget.
        Now it will be displayed in Blog post >> Comments >>  Related Posts order.
   6. Now if you want to add this just below the blog post and above  comments, follow the below steps.
   7. Navigate to Layout >> Edit HTML >> Expand Widget Templates and search for the below code.

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

   8. Add the following code just below the above code in your template.

      <div id='related_posts'/>

   9. Now the whole code should look like the below screenshot :

   10. Save your template at this point.

  11. Now again search for </body> tag in your template. You can also scroll down to end of your template,  it’s located there.
  12. Add the following codes just above that </body> tag.
       <script src=''/>
      <script src='' type='text/javascript'/>

  13. Save your template and you are done.

These are the methods to add Related posts blogger widget on your blogspot blog. You can follow either the first or the second method to get the related posts showing just below your blogger posts.

If above methods are not working: Click Here For another methods
Fb Comments
Comments :


Post a Comment