Popular Or Most Commented Posts Widget For Blogger - Helper Blogger

Blogger Widgets | Templates | Tutorials

Latest

Thursday, 23 February 2012

Popular Or Most Commented Posts Widget For Blogger

Show off your most popular posts and at the same time prevent them from being buried in the archive -using Popular Post widget.
This time we will be making a Popular Posts widget for Blogger blog. The popularity rank is based on the number of comments each post receives. The comment counts are extracted from your blog’s latest 1000 posts, using a Yahoo! Pipe.Now lets see how to add this widget to blogger.


How To Add Most Commented Posts Widget To Blogger?


  • Go to Design > Page Elements.
  • Click Add A Gadget link.
  • Select HTML/Javascript gadget.
  • Enter the title of your widget e.g. Popular Posts.
  • Copy and paste the code inside the content box.
  • Save and view your blog.

<!-- Popular posts with comment count Start -->
<script type="text/javascript">
function getYpipePP(feed) {
document.write('<ol style="">');
var i;
for (i = 0; i < feed.count ; i  )
{
var href = "'"   feed.value.items[i].link   "'";
var pTitle = feed.value.items[i].title;
var pComment = " \("   feed.value.items[i].commentcount   "\)";
var pList = "<li>"   "<a href="  href   '" target="_blank">'   pTitle;
document.write(pList);
document.write(pComment); //to remove comment count delete this line
document.write('</a></li>');
}
document.write('</ol>');
}
</script>
<script src="http://pipes.yahoo.com/pipes/pipe.run?
YourBlogUrl=http://www.helperblogger.com
&ShowHowMany=10
&_id=390e906036f48772b2ed4b5d837af4cd
&_callback=getYpipePP
&_render=json" 
type="text/javascript"></script>
<span style="font-size: 80%; float:right;"><a href="http://www.helperblogger.com/" target="_blank">Make your own</a></span>
<!-- Popular posts with comment count End -->

Some Customization


  • Replace highlighted http://www.helperblogger.com with your blog URL.
  • If you want show the less number or more number of posts then find this line ShowHowMany=10 and change the value 10.
  • If you want to delete comment count then find this line document.write(pComment); //to remove comment count delete this line and delete it.

Making your own pipe (Optional)


If you want further customize the widget output, you need to edit the (Yahoo) pipe itself. Follow the steps below:


  • Go to the Yahoo! pipe.
  • Log in to your Yahoo! account.
  • Create a clone by clicking the Clone button.
  • Click edit source to edit it in anyway you like.
  • When you’re done editing and saving, test run it by clicking Run Pipe button to confirm the output of the pipe.
  • To use your edited pipe, copy the pipe Id and paste it to replace the existing id in line 22. (To get the Id, look in your browser’s address bar. It is the end part the url when you are viewing or editing the pipe.)

Enjoy!

1 comment:

  1. popular post widget is the best way to gain some traffic for some late and popular posts of the blogs.such widget also helps to reduce the bounce rate of the blog because user stays on the blog for long time and hence it helps to increase traffic and visibility of the blog.thanks for sharing with us.Aashiqui 2 ringtones

    ReplyDelete

If you want to be informed about any replies then check "Notify me" option (present at lower right corner of comment box and it will display if you are logged in to your google account). PLEASE DO NOT SPAM