Octopress Top Categories Plugin

I have a lot of categories on this blog, particularly for astronomical objects, but I realized that Octopress doesn’t come with a page listing the categories by default. This would be very useful for me, especially as a quick way to look up an object to see if I’ve seen it before, so I installed this categories list plugin for Octopress.

This plugin was all well and good for making a list or cloud of all your categories, but there wasn’t anything for ordering the categories by number of posts. In addition, the asides that shipped with the plugin showed all of the categories, which isn’t what I wanted for a sidebar item. This, I’ve forked that plugin and made my own categories list plugin with top categories support.

To Use The Top Categories List

First, install the plugin as detailed in the README.md. If you’d like the top category list in your sidebar, add custom/asides/top_category_list.html to your asides list in _config.yml. If you’d like to change the number of entries in the top categories list, set top_category_limit in _config.yml. The default is 10. Setting it to 0 will list all the categories in descending order, which might not be what you want. If you’d like to have the sidebar item with a sane number of categories, but also have a page with all of your site’s categories, simply include include_all:true in the snippet’s arguments as demonstrated in the README.md.

This is, of course, by no means a particularly complicated Octopress plugin, but it’s something I needed, and I have to think others might find this useful too. It’s nice, at least, to get some sort of non-Astro Log related content on the side there. It’s important to keep up to date with that, but it can kind of overwhelm everything else; it’s a lot easier to blog about my observations than most anything else.

You can see the Top Categories, ordered by number of posts, on the Top Categories page, and compare it with the alphabetical category list. Both of them could use some styling, I think, but it gets the point across. I have making further style improvements to the site planned anyway.

comments powered by Disqus