I recently added a new section to the right side of this blog called "Recent Reader Comments". As the name implies, it is a list of the 10 most recent comments people have left on mygtdstuff.com.
I did not find a standard Google Blogger widget to do this. I did find quite a few 3rd party Blogger widgets (or "gadgets" as they are now called). Unfortunately, all of the 3rd party widgets I found require that you run some script on a mystery server. You have no idea what this script is doing. You do not get to see the code. Odds are, these 3rd party scripts are at a minimum adding cookies to your users browser. Worse yet, these 3rd party scripts could be doing (or adding) something evil to your readers computer. I'm not willing to take that risk.
Finally, I found a very cool way to add a recent comment list from a site called Hackosphere. The nice thing about this method is that it works with standard Google Blogger functionality. The folks from Hackosphere show you the program code that you will need to make it work. Full disclosure. No mystery scripts!
Here is how it works;
- Sign in to Blogger to Edit your Blog. Select the Layout tab, the click Edit HTML.
- Click the Download Full Template link to save a backup of your Blog Template.
- Find the </head> tag in the HTML of your Blog Template
- Add the code from this page directly after the </head> tag
- Save your Template
- Next, click Page Elements then Add a Gadget
- Select the HTML/JavaScript Gadget
- Add this code to the HTML/JavaScript Gadget:
<br/><script language="javascript">
var numcomments = 10;
var numchars = 100;
</script>
<script src="http://yourblog.blogspot.com/feeds/comments/default?
alt=json-in-script&callback=commentDisplay"></script> - Customize this code as needed:
- Change the numcomments variable to the number of comments to display
- Change the numchars variable to the number of characters from each comment to display
- Change the "yourblog" text to the name of your blogger blog - Click Save.
Thats it. 10 quick and easy steps to a recent comments widget/gadget. Big thanks for Hackosphere for the code to make this work!
No comments:
Post a Comment