125px

Moving to Octopress

It was time that I did a revamping of my site. Long story short, I moved it over to Octopress. I’m liking it so far.

Site History

I originally wrote this website using BBEdit’s include functionality and served the generated static files. I also wrote some Python scripts that got called and inserted content in the web pages at the time of generation.

After that, I ran the website on PyBlosxom. Very nice and cool blog engine, but after playing with ikiwiki, I decided I wanted to go back to a statically served website that was less ‘bloggy’. By that I mean I wanted to organize non-blog pages, articles if you will, in the manner that I wanted to. So I decided to write my own Python script (pyopyo) to take my posts and convert them to a website. Tags and templates were supported with it.

Over the next several months, the script got reasonably sophisticated. I’m still interested in developing it, but the lack of blog like function started to annoy me. I have some ideas of how to implement that function, but for now, I decided to move the site to another platform to get what I need. No sense in putting off adding content to the site because I haven’t had the time/motivation to implement a necessary feature.

Octopress

That brings us to Octopress. In the software’s own words:

Octopress is a framework designed by Brandon Mathis for Jekyll, the blog aware static site generator powering Github Pages.

It’s actually quite like the program I was developing, only written in Ruby. It’s a bit further along than my program since it is based off Jekyll, which is in turn based on Liquid, a templating system. It has some features that I was missing, like the blog functionality, which in turn needs a pagination function. This was one of the demotivators for me in implementing a blog in pyopyo.

Furthermore, it’s got a really nice default theme and is based on some other new-to-me tech, like Sass and Compass. Needless to say, I’m going to start using these guys in other web projects.

Articles plugin

While Octopress does have the ability to process non-blog posts known as pages, these pages lack some of the feature set that posts have. So I wrote a Ruby plugin by trial and error (I have NO experience with Ruby) to find pages that have an ‘articles’ category and add them to the category index pages.

They are also added to the site object under site.articles, so you can access them through Liquid tags. For example, if you wanted to loop through all of the articles with the category of ‘articles’ (convenient to get a list of them all), you would use the following code on your page:

<div id="blog-archives" class="category">
{% for post in site.articles['articles'] %}
    {% capture this_year %}{{ post.date | date: "%Y" }}{% endcapture %}
    {% unless year == this_year %}
        {% assign year = this_year %}
        <h2>{{ year }}</h2>
    {% endunless %}
    <article>
    {% include archive_post.html %}
    </article>
{% endfor %}
</div>

You can see the above code in action on the Articles pages on this site. I also added similar blocks to the _source/category_index.html page to list articles under their appropriate category.

The plugin’s source is on Gist.

Other modifications

I’m basically using the supplied theme for the layout of the site. I did have to tweak one or two lines on a couple of files, but most of the changes are in non-theme files, like the supplied ‘custom’ layout and Sass files.

I also snagged a flickr aside.