Saturday, February 7, 2009

How I added the Recent comments list to my blog

This post has nothing to do with the actual theme of my blog, but I am including it here as I had to read a lot of articles in the net to finally zero in on a widget that works, and dont want other bloggers to go throught the same routine. Here I am trying to present the simplest ways to add the widget to your blog. I have only tried it in Blogger.

There are two methods and the outputs also vary accordingly.

First Method : I think it was from blogger buster i got this code


<script style="text/javascript" src="http://kunoichi.info/blogger_buster/comments.js"></script><script style="text/javascript">var a_rc=5;var m_rc=true;var n_rc=true;var o_rc=100;</script><script src="http://pappuandpinky.blogspot.com/feeds/comments/default?alt=json-in-script&callback=showrecentcomments"></script>

copy the above code.


In your blogger 'dashboard' goto 'Layout'. Click on the 'add a Gadget'. Select the 'HTML/Javascript' widget by Blogger. Paste the code there. Give a heading. Do the following modifications

Instead of 'pappuandpinky' in the code, type your blog name. Save the changes. You are done!! congrats. You will have a 'Recent comments section like the one on my page.

Tweaks:
var a_rc=5 :means the last 5 comments will be shown. You can change it as desired.
var o_rc=100 :means the first 100 letters of the comments will be shown

Second Method

Take Blogger dashboard. Go to Layout. Click on 'add a gadget'. select the 'Feed' gadget. For the 'Feed URL' enter 'http://YourBlogName.blogspot.com/feeds/comments/full'
Once you click 'Continue' Blogger will automatically show the next page with selctions for the 'number of post', 'date' etc. Select according to your wish and 'OK' it.

Advantages and Disadvantages of the above methods

The first method depends on a third party javascript. There is no guarantee about it. If you are skeptical about other party links or third party cookies dont use it. If the site hosting that code is down then the Gadget wont work. But I have chosen this code only on my blog as It was the most pleasing for me.

The second method is the most sure and secure method but the options in it are less. The number of comments are upto 5 only. You cannot tweak it.


Hope you will find it easy to put on your blog. All the best.

No comments:

Post a Comment