How To Add Automatic Related Posts for Blogger

Hello Guys and welcome to Wolv Themes Our Tutorial today is about How To Add Automatic Related Posts.

Why Add Automatic Related Posts ?

adding automatic related posts is very nice trick to help your visitors to check another posts while reading one of your posts and the best thing is that it is automatically added to all your posts and smartly puts really related posts to your post content and helps for Seo because it makes backlinks for all your posts and many more...

Benefits :-

  • Backlinks for all your posts 
  • Let the visitors check more posts 
  • Get More Traffic 
  • Help in posts indexing for Google search console
Let's Start

How To Add Automatic Related Posts :-

Step 1 :-Go to Blogger's dashboard and click theme.
Step 2 :-Click the arrow down icon next to the 'customize' button.
Step 3 :-Click Edit Html.
Step 4 :-Click on any word then Press CTRL+ F and type in the search form </b:defaultmarkup>.
Step 5 :- Copy the provided below code and paste it just before </b:defaultmarkup>.
     
<b:includable id='postTextRelated'>        
<div class='postRelated' id='postRelated'>          
<script>/*<![CDATA[*/ var relatedTitles = new Array(); var relatedTitlesNum = 0; var relatedUrls = new Array(); function related_results_labels(json) { for (var i = 0; i < json.feed.entry.length; i++) { var entry = json.feed.entry[i]; relatedTitles[relatedTitlesNum] = entry.title.$t; for (var k = 0; k < entry.link.length; k++) { if (entry.link[k].rel == 'alternate') {relatedUrls[relatedTitlesNum] = entry.link[k].href; relatedTitlesNum++; break;}}}} function removeRelatedDuplicates() { var tmp = new Array(0); var tmp2 = new Array(0); for(var i = 0; i < relatedUrls.length; i++) { if(!contains(tmp, relatedUrls[i])) { tmp.length += 1; tmp[tmp.length - 1] = relatedUrls[i]; tmp2.length += 1; tmp2[tmp2.length - 1] = relatedTitles[i];}} relatedTitles = tmp2; relatedUrls = tmp;} function contains(a, e) { for(var j = 0; j < a.length; j++) if (a[j]==e) return true; return false;} function printRelatedLabels() { var r = Math.floor((relatedTitles.length - 1) * Math.random()); var i = 0; document.write('<ul>'); while (i < relatedTitles.length && i < 20) { document.write('<li><a href="' + relatedUrls[r] + '">' + relatedTitles[r] + '</a></li>'); if (r < relatedTitles.length - 1) { r++; } else { r = 0;} i++;} document.write('</ul>');} /*]]>*/</script>          
<b:if cond='data:post.labels'>            
<b:loop index='i' values='data:post.labels' var='label'>              
<b:if cond='data:i&lt;1'>                
<script expr:src='&quot;/feeds/posts/default/-/&quot; + data:label.name + &quot;?alt=json-in-script&amp;callback=related_results_labels&amp;max-results=3&quot;' rel='preload'/>              
</b:if>            
</b:loop>          
</b:if>          
<b>See Also :</b>          
<script>removeRelatedDuplicates(); printRelatedLabels();</script>        
</div>      
</b:includable>
Step 4 :-Click on any word then Press CTRL+ F and type in the search form <div class='postBody' id='postBody'>.
Step 5 :- Copy the provided below code and paste it just after <div class='postBody' id='postBody'>.
<b:include cond='data:view.isPost and !data:view.isPreview' data='post' name='postTextRelated'/><script>/*<![CDATA[*/ function insertAfter(tbh,tgt) {var prt = tgt.parentNode; if (prt.lastChild == tgt) {prt.appendChild(tbh);} else {prt.insertBefore(tbh,tgt.nextSibling);}} var tgt = document.getElementById("postBody"); var midAd3 = document.getElementById("postRelated"); var showAd3 = tgt.getElementsByTagName("p"); if (showAd3.length > 0) {insertAfter(midAd3,showAd3[5]);}; /*]]>*/</script>

Rate this article

Frontend Developer and UX Designer

4 comments

  1. Great Article on Blog design Css And Html Tutorials and Premium Blogger Themes Free Download

    Blog Name Techy Jeeshan
    Blog Url :- https://www.techyjeeshan.xyz/
    1. Thanks Very Much For Your Comment, and hope the article was helpful
  2. Sir, i am using median ui 1.6 but that <div class='postBody' is not visible to me
  3. Sir, i am using median ui 1.6 but that <div class='postBody' is not visible to me