How to Display Recent comments in Blogger

Advertisements
In the past, we have already showed you how to add recent posts in your blogger site. However, we never happen to discuss how to display recent comments in blogger. Thanks to our readers, who emailed us about this topic to turn our attention towards it. Today in this article, we will show you how to display recent comments in blogger either in your sidebar, footer or any other place you like. May be you would like to add it in your 404 not found page to make it useful.


Why to Add Recent Comments Widget in Blogger?

You might have an active community on your blog, where people often leave a comment or two on your multiple posts. However, people who leave comments on your blog are actually your followers as you don’t really see new people commenting on your blog posts unless they need help.  So, this widget could help new visitors in motivating them to take part in the conversation which would certainly increase the engagement as well.

How to Add Recent comments in Blogger?

The very first thing that you’ll be doing is to login into your blogger dashboard with your Google account. After logging in go to Layout >> Add a Gadget >> Add HTML/JavaScript and paste the following piece of coding that will turn into a list of recent comments on your blog.

<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://www.mybloggerlab.com/feeds/comments/default?alt=json-in-script&callback=showrecentcomments ></script>
<style type=text/css>
.rcw-comments {
font-family: inhert;
font-size: 14px;
margin-bottom: 15px;
border-bottom: 1px solid #d2d2d2;
padding-bottom: 15px; line-height: 20px; }
}
</style>

You need to replace your Website URL, so that this widget will work just fine. To increase the number of comments shown on the widget simply search and replace “5” with the no of comments on you want to show.  If you like to display dates along with comments than replace “False” with true. If you want to limit comment characters then replace “100” with any other that you like.

After customizing you can save the widget by pressing "Save" button present towards the end of the widget. Once done, you will be able to see recent comments on your blog.

We hope this tutorial may have helped you in learning how to display recent comments in blogger. We have used JavaScript to display these comments, so if you turn off JavaScript from your browser's setting it will stop appearing. However, almost 99% browser nowdays support JavaScript, so its not a that big issue. Let us know what are your thoughts about it, share it with your friends on Facebook, Google+ or Twitter.
Advertisements

The Editorial Team of MyBloggerLab consists of a group of Professional Blogger geeks Led by Syed Faizan Ali (Founder of MyBloggerLab).

Comment With:
OR
Choose Wisely!

11 comments

July 24, 2014 at 2:24 PM

Gud Work

July 26, 2014 at 12:07 AM

really nice thanks

August 13, 2014 at 1:06 AM

Thanks for Sharing,,

June 21, 2015 at 7:42 PM

Is it possible for your widget to display the title of a post rather than the text generated from the URL? For instance, for dansator.blogspot.com/2014/08/guardians-of-galaxy-4-stars.html I want "Guardians of the Galaxy (4½ Stars)" to appear, not "guardians of galaxy 4 stars"

January 31, 2016 at 9:35 PM

hi there - i can't get this to work - my comments aren't showing up - the header of the widget is there but no content. my comments are restricted to blog authors - could that have anything to do with it? (there are plenty of comments). thanks!

Editorial Team MOD
February 14, 2016 at 10:53 AM

You blog needs to be avaliable for public users to make this widget work.

May 13, 2016 at 11:17 AM

On the replacement of the placeholder here for my blog (Sierradragonsbreathe), do I leave the http:// and ass www.? I cannot seem to make this work after many tries. I must be a dunce I guess.

Todd
tjj54@comcast.net

Editorial Team MOD
May 27, 2016 at 11:24 PM

Hi Todd,

You just need to replace the BOLD Text i.e.

www.mybloggerlab.com

With your URL like

www.example.com

Editorial Team MOD
May 27, 2016 at 11:24 PM

If you are on .Blogspot then Change HTTP to HTTPS

June 3, 2016 at 5:38 AM

Sir its not working is it possible to add a mybloggerlab based recent comment widget? helpblloger widgets downt work any more. There is a recent post widget of mybloggerlab make a recent comment widget like that

Editorial Team MOD
June 7, 2016 at 2:30 AM

Hi,

We have updated the script.

Cheers

Post a Comment

We’re eager to see your comment. However, Please Keep in mind that all comments are moderated manually by our human reviewers according to our comment policy, and all the links are nofollow. Using Keywords in the name field area is forbidden. Let’s enjoy a personal and evocative conversation.

Helping You to do Cool Things With Blogger Since 2012™.

© Copyright 2012 - 2018. MBL Networks, All Rights are Strictly Reserved.