Title photo
frugal technology, simple living and guerrilla large-appliance repair
Wed, 13 Jan 2016

The Counter addin, version 2, for Ode sites

I've been meaning to get back into the Counter addin that I wrote for Ode with Rob's help, and over the past few days I added some functionality to the code and deployed it on my site, where you can see the results in the right rail.

The original Counter addin only counted posts, which in my case are files in the documents directory with .txt suffixes.

Since I now create many of my social-media updates with Ode, I added some code to count those entries and report how many of the overall entries are "full" posts and how many are social updates.

While I was in there, I wanted to play around with regular expressions, so I also added a count for the number of jpg and png images both in the entire documents directory (which includes themes) as well as in my images directory (where I try to keep all images that go into posts).

It's definitely fun to write a very little bit of Perl and have something happen on my live site. It's a nice feeling, for sure.

The addin uses the File::Find CPAN module to crawl your filesystem and count the files.

The way the Counter addin works is that you download it (for now I'm hosting it here) and unzip it, stash the addin's directory/folder in your addins directory (mine is under /data/addins), add some HTML with calls to the addin to your theme (generally in the sidebar area), and it should just work.

Once again, thanks to Rob Reed for creating Ode and helping me get off the ground with this addin.

If you missed the link above, download the new Counter addin from my site.

I still have some code cleanup to do, and I will probably add some documentation, licensing information and acknowledgments. But this version does work.

In the future, I can see this addin, or something like it, creating even more dynamic (or even static) content for the sidebar of an Ode site. It could help build a list of directories and certainly could provide more statistics on how many posts you have under any given directory.

But for now I can instantly see how many posts and social updates I have written (and you can, too).