Friday, April 15, 2011

Blogger- Display popular posts based on comments!

1) Create a new page or a new gadget in the sidebar.
2) Add the following code in Edit HTML mode.
3) Replace your blog address instead of URL
4) Click publish post. Done!



<!-- 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.bloggersentral.com
 &ShowHowMany=10
 &_id=390e906036f48772b2ed4b5d837af4cd
 &_callback=getYpipePP
 &_render=json" 
type="text/javascript"></script>
<span style="font-size: 80%; float:right;"><a href="http://www.bloggersentral.com/2010/04/popular-most-commented-posts-widget.html" target="_blank">Make your own</a></span>
<!-- Popular posts with comment count End -->

Creating a Contents Page on blogger, Simple!

  1. Create a Page first - go to Dashboard | Edit Posts, which will then open the Posting tab in Blogger. Select Edit Pages, click on the New Page button and type in the Page title, e.g Archives, Table of Contents or Sitemap, or whatever that you fancy. Ideally, the title should be short as that will also serve as the page tab's name in your blog. (Incase you dont have pages gadget, first click on "design" and you will see a template of your blog. In the top-center click on "Add gadget" and the gadget list select "pages" Restart step 1)
  2. Next, select the Edit HTML mode to prepare your page. Copy and paste the following code into the post box :

    <script src="http://abu-farhan.com/script/daftarisibloggerarchive/tocbyarchivemin.js">
    </script>
    <script src="http://URL HERE/feeds/posts/default?max-results=500&amp;alt=json-in-script&amp;callback=loadtoc">
    </script>

    Then, change the code in red to the URL of your blog like 'trivialstrife.blogspot.com' (without the single quotes). Click save. 
  3. DONE!