Getting word count stats for my blog
For a while I’ve wanted to see how much I’m writing – not for anything in particular, just idle curiosity. Today I decided to sit down and actually plot the data. I’ve got a new chart which shows me how many words I’ve written, on a month-by-month basis:

You can see a live version at https://alexwlchan.net/stats/, which will automatically update as I write new posts. (I took the screenshot above before I started this post, so it’s already out-of-date.)
This info also tells me that I’ve written ~197k words across the entire blog, which is almost as long as Harry Potter and the Deathly Hallows. And while my blog isn’t quite as popular, it does have several things to recommend it over JK Rowling’s books:
- There’s an explicitly queer character
- The only snake you’ll encounter is a friendly Python, not a deadly Basilisk
- I don’t include bad facts about trains
If you’d like to get something like this for your own blog, the source code is on GitHub:
-
word_counter.rb
is a custom Jekyll plugin that gets the word counts. It reads every post, removes blockquotes and code blocks (which I don’t count as words I’ve written), then adds the word count of that post to the running total. -
I’m using Charts.js to render the chart itself. You can see the config I’m using in
stats.md
.