Blog popularity: it’s nice to know what’s popular and what’s not with visitors on a blog and a summary of the most popular entries helps those who’ve not visited before. Thing is, there’s a problem… most blog popularity measures are based on visits for all time, so what if you write a new article?

How it works

Page views are tracked over the last month and the most popular rises to the top of the list. If one article becomes more or less popular, it’ll move in the list. Sounds obvious really, but most popularity trackers collect data for all time, so if an article was really popular last year then it’d still be at the top even if no-one was actually reading it.

My plugin works differently–by storing sequential numbers of page views over consecutive time periods, the ‘old ones’ can be thrown away and the popularity measure is thus always current.

You can have it too

If you run Habari, you’ll find this plugin in the Habari Extras repo under the name relativelypopular. This plugin works well with Habari 0.7–0.9. Once installed, you can configure the number of time periods it tracks for and the length of one period.

The menu can be shown in a location of your choosing by adding the Relatively Popular Posts block from your theme configuration screen.

Once you’ve let it run for a few days, why not show a mini-graph in your theme by using this:

$RelativelyPopular->sparkline( $content );

You could make it look a bit like this, for instance:

Example rendering of a sparkline

You can find the code for this at github.com/habari-extras/relativelypopular; it’s not actively maintained any more since I moved away from Habari for this blog, but is linked for general interest.