As of 2016-02-26, there will be no more posts for this blog. s/blog/pba/
Showing posts with label popular post. Show all posts

I found some search hits on my blog were actually the false positives. The keywords the visitors used were actually hit on the Popular Post list.

I don't like this, so I remove it. It's the same reason why my blog doesn't have Recent Posts or some other whatsoever the lists they are. I hate when I click on a result and find out that's not what I am looking for at all. I have encountered a few times, that the results were from blogs' blogroll. What can you do about it? Nothing, no one do care. Search engine providers do not care, blog owners do not care. Hits are all they care. (The last sentence is not totally true but close)

I even added <meta content='noindex' name='robots'/> to yearly/monthly archive pages for preventing more such occurrences. Search engines are still too dumb, let's all I could say.

I am thinking to add an AJAX version of Popular Posts list, but I haven't got a nice idea to do so. It's obviously I couldn't get the list from the official list since there is no API available.

If I could, I would put some buttons on. Visitors could decide if they want to load of lists of some things, such as Popular Posts, Recent Posts, Recent Comments, etc.

By the way, while I was removing the gadget, I saw Blogger has used a new good-looking dialog:

2010-11-21--07:18:27

Updated 2010-11-21


I was thinking to do something like this, which uses FeedBurner Awareness API to list popular entries. I have written an working code, here is the diff for my existing script:

diff -r c29f74858f02 src/static/g/fb/fb.js
--- a/src/static/g/fb/fb.js Mon Nov 01 19:45:52 2010 +0800
+++ b/src/static/g/fb/fb.js Sun Nov 21 14:19:49 2010 +0800
@@ -33,6 +33,21 @@
   }
 
 
+function lilbtn_g_fb_get_resyndication_data(feed_url, dates, callback) {
+  if (!feed_url || !callback)
+    return
+  google.setOnLoadCallback(function() {
+    var query = "select * from xml where url='https://feedburner.google.com/api/awareness/1.0/GetResyndicationData?uri=" + encodeURIComponent(feed_url) + (!!dates ? "&dates=" + dates : "") + "'"
+    $.getJSON("http://query.yahooapis.com/v1/public/yql?q=" + encodeURIComponent(query) + "&format=json&callback=?", function(json) {
+      if (json.error)
+        callback(json)
+      else
+        callback(json.query.results.rsp);
+      });
+    })
+  }
+
+
 function lilbtn_g_fb_text_render(feed_url, container, _texts) {
   lilbtn_g_fb_get_feed_data(feed_url, function(rsp) {
     if (container == undefined)
@@ -89,4 +104,46 @@
       ele.attr('class', ele.attr('class') + ' lilbtn_g_fb_feedcount');
     });
   }
+
+
+function lilbtn_g_fb_popular_items_render(feed_url, container) {
+  lilbtn_g_fb_get_resyndication_data(feed_url, '2010-11-11,2010-11-19', function(rsp) {
+    if (container == undefined)
+      container = 'lilbtn_g_fb_popular_items';
+    var $ele = $('#' + container);
+    if (rsp.error || rsp.stat != 'ok') {
+      var msg = 'Error on retrieving resyndication data: ' + ((rsp.error) ? rsp.error.description : rsp.err.msg) + '; Click to check out lil\u2218btn website for help';
+      ele.html('<a href="http://lilbtn.appspot.com/help" class="lilbtn_g_fb_popular_items lilbtn_error""><img src="http://lilbtn.appspot.com/img/error.png" alt="' + msg + '" title="' + msg + '"/></a>');
+      return;
+      }
+    var items = {};
+    $.each(rsp.feed.entry, function(idx_e, entry) {
+      if(entry.item)
+      $.each(entry.item, function(idx_i, item) {
+        if (items[item.url]) {
+          items[item.url].score += parseInt(item.itemviews);
+          }
+        else {
+          items[item.url] = {title: item.title, url: item.url, score: parseInt(item.itemviews)};
+          }
+        });
+      });
+    var items_sort = [];
+    $.each(items, function(url, item) {
+      items_sort.push([item.score, item]);
+      });
+    // Sort from highest to lowest score
+    items_sort.sort(function(a,b){return b[0] - a[0];});
+    items = $.map(items_sort, function(item) {return item[1]});
+    delete items_sort;
+    var $ul = $('<ul/>');
+    $.each(items, function(idx, item) {
+      var $li = $('<li/>');
+      var $a = $('<a/>').attr('href', item.url).text(item.score + ': ' + item.title);
+      $li.append($a);
+      $ul.append($li);
+      });
+    $ele.append($ul);
+    });
+  }
 // vim:ts=2:sw=2:et:ai:

I am not going to put this on. After I saw the results, I knew it's not a good idea. Because only entries currently in feed would get view counts or click-through, which doesn't reflect the real view counts. You can not really call them as popular posts. Popularly recent posts might make more sense.

I guess Popular Posts wouldn't come back anytime soon.

PostRank is a great service that gives you some good statistics of your blog posts. It provides a nice thematic widget for your top posts — popular posts, of course, it also let you customize it. I have been using this thematic widget over my blogs for months. I didn't try customizing it which was due to my prejudice which consists of my experince of iframe. I believed that CSS can not be applied on iframe and the document in iframe, therefore I never tried. Earlier, I read on PostRank's GetSatisfaction, those questions and answers indicate that I was wrong. I tried and I am happy with the result.

If you choose the right-most option while customizing, you will see a partial code like:
var options = {
    "feed_hash": "cbfa4ed49ae77050fb48ccbb47a101bc",
    "num":        6 ,
    "theme":     "diy"
};
new PostRankWidget(options);

Note that "theme":     "diy".

Now check out the following screenshots, first one is the thematic, latter is customized:

 

Here is the CSS that I applied:
/* BEGIN: PostRank */
/*
ul.postrank-posts {
list-style-type:none;
padding-left:0;
}
*/
ul.postrank-posts li{
margin-bottom:0.1em;
}
a.postrank-value {
color:#000;
width:3em;
display:block;
float:right;
clear:both;
text-align:center;
}
table.postrank-options {
display:none;
}
/* END: PostRank */
I put the PostRank value on the right side because I couldn't make it perfectly on the left. However, the result it not bad at all. If you can make it on left, share with me.

One more thing to note, I only test on Firefox. 90% chance that I believe it will be broken on Internet Explorer since this blog already is.