“Most Popular Entries” sidebar

April 1st, 2003  |  Published in perl, rss  |  3 Comments

Noticing the variety in popularity amongst the different topics that the pieces on this site cover, I added a “Most Popular Entries” sidebar to keep track of what people are reading. This is done with a simple application of Apache::ParseLog, XML::RSS, movabletype’s XML-RPC interface and a movabletype plugin.


Every night after midnight, hits.pl runs and inspects the previous day’s Apache access log. Every entry has a predictable URL of the form https://www.hackdiary.com/archive/000articleID.html, so the code looks for hits on those URLs and parses out the article ID. It updates a dbm file, adding the day’s hits to hits already recorded for each item.

After that’s finished, hits2rss.pl is run and translates the dbm file into an RSS file by looking up the article titles via the MT XML-RPC interface. An MT plugin parses that file when the index page is rebuilt and makes the sidebar.

Fun hacks like this make me wish that MT had a license that allowed distribution of modifications to its core. Although the plugin interface is flexible, it’s a dead-end in the long run without the ability to dig in and change things under the skin.

Responses

  1. hebig.org/blog says:

    May 1st, 2003 at 5:10 pm (#)

    Movable Type News Roundup

    An unsorted list of interesting Movable Type related items I came across the last days: Offline authoring of blog entries…

  2. hebig.org/blog says:

    May 1st, 2003 at 5:12 pm (#)

    Movable Type News Roundup

    OFFLINE AUTHORING Offline authoring of blog entries can be quite an issue. I used to do this for a while…

  3. Kenan KARA says:

    August 7th, 2003 at 6:59 pm (#)

    Perfect,

    http://www.kenankara.com