Recent Comments Widget For Blogger

The recent comments widget for blogger will display the most recent comments on your blog in your sidebar for all your visitors to see. It will display a snippet of the comments along with the title of the post the comment was made on.

The recent comments widget for blogger is encoded in javascript and styled with css in such a way that it will fit with the design of almost any blog.




Ways you can customize the recent comments widget:



  • Change the number of comments that are displayed
  • Show or hide the date of the comment
  • Show or hide post titles
  • Change the number of words quoted in the excerpt of the comment


How to add the recent comments widget to blogger


From your blogger dashboard select layout and click add an gadget.

From the window that appears select the HTML/javascript option

Copy and paste the below code

<script type="text/javascript">
var a_rc = 5;
var m_rc = false;
var n_rc = true;
var o_rc = 100;
function showrecentcomments(e){for(var r=0;r<a_rc;r++){var t,n=e.feed.entry[r];if(r==e.feed.entry.length)break;for(var i=0;i<n.link.length;i++)if("alternate"==n.link[i].rel){t=n.link[i].href;break}t=t.replace("#","#");var a=t.split("#");a=a[0];var c=a.split("/");c=c[5],c=c.split(".html"),c=c[0];var s=c.replace(/-/g," ");s=s.link(a);var o=n.published.$t,l=(o.substring(0,4),o.substring(5,7)),u=o.substring(8,10),m=new Array;if(m[1]="Jan",m[2]="Feb",m[3]="Mar",m[4]="Apr",m[5]="May",m[6]="Jun",m[7]="Jul",m[8]="Aug",m[9]="Sep",m[10]="Oct",m[11]="Nov",m[12]="Dec","content"in n)var d=n.content.$t;else if("summary"in n)var d=n.summary.$t;else var d="";var v=/<\S[^>]*>/g;if(d=d.replace(v,""),document.write('<div class="rcw-comments">'),1==m_rc&&document.write("On "+m[parseInt(l,10)]+" "+u+" "),document.write('<span class="author-rc"><a href="'+t+'">'+n.author[0].name.$t+"</a></span> commented"),1==n_rc&&document.write(" on "+s),0==o_rc)document.write("</div>");else if(document.write(": "),d.length<o_rc)document.write("<i>&#8220;"),document.write(d),document.write("&#8221;</i></div>");else{document.write("<i>&#8220;"),d=d.substring(0,o_rc);var w=d.lastIndexOf(" ");d=d.substring(0,w),document.write(d+"&hellip;&#8221;</i></div>"),document.write("")}}}
</script><script src=http://your-blog-name.blogspot.com/feeds/comments/default?alt=json-in-script&callback=showrecentcomments></script><div style="font-size: 10px; float: right;">Get this <a href="http://helplogger.blogspot.com/2012/03/recent-comments-widget-for-blogger.html">Recent Comments Widget</a></div>
<style type="text/css">
.rcw-comments a {text-transform: capitalize;}
.rcw-comments {border-bottom: 1px dotted;padding: 7px 0;}
</style>

Replace http://your-blog-name.blogspot.com with the address of your blog

How to change the other setting



  • To change the number of comments dislayed, change the value of 5 in the rc=5 value
  • To hide or display the date change the value of m_rc to true or false
  • To hide or display post titles change the value of n_rc to true or false
  • To change the length of the number of words of the excerpt change the false of o_rc to the desired amount of characters 

4 comments:

  1. I found this website very good.
    "Blogs for Women"
    Thanks.

    ReplyDelete
  2. This is a very nice post. Thanks for sharing it. You must visit us too and learn How to Discover Investors For Startup and get complete knowledge, support and ideas for your startup business.

    ReplyDelete
  3. Hi! I'm shruti . This is my first comment here so I just wanted to give a quick shout out and say I genuinely enjoy reading your blog posts. Can you recommend any other <a href='http://microniche.world/best-niches-for-affiliate-marketing/>Niches for Affiliate Marketing</a> blogs that go over the same topics? Thanks a ton!

    ReplyDelete

Powered by Blogger.