0
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!

Post a Comment

 
Top