Andrei Mackenzie

Andrei Mackenzie

Principal Software Engineering Manager at Microsoft

22 Dec 2010

Jekyll

I’ve been looking into web frameworks for building a simple site. I want something extremely lightweight, yet something that would still save me the effort of duplicating lots of boilerplate HTML any time I want to add something. My most recent previous experience is with b2evolution, which I found complicated to customize. In general, anything that keeps content that is generally only rendered in one or two ways (such as blog posts) in a relational database seems like overkill.

Why Jekyll?

After looking around a bit, I came across Jekyll. Unlike other open source frameworks, Jekyll merely acts as a pre-processing engine that generates simple static HTML. Content can be stored separate from templates in one of several supported lightweight markup languages, such as Textile. Jekyll also provides some powerful tools for rendering content in different ways using the Liquid.

The real strength of Jekyll is its template capability. Templates allow layouts to be shared among any number of content pages. Templates can recursively reference other templates, meaning even the most general boilerplate HTML only needs to be defined once.

Jekyll also works with Pygments for syntax highlighting.

Jekyll on NearlyFreeSpeech.net

Jekyll is a natural choice for a site hosted on NearlyFreeSpeech.net. Instead of charging a flat monthly rate, NFS.net charges per quantity of resource used by each site. Since Jekyll generates completely static sites, there is no need to pay for SQL processes or even a dynamic site. This ends up being extremely cost effective for a simple site, while maintaining many of the benefits of dynamism through the power of Jekyll’s templates.

I’ve read a recommendation to install Jekyll directly on the site’s NFS.net share and to even host the Git repository there. I find it simpler to run Jekyll locally and simply publish the static site using a Make target:

publish: build
    rsync -avz --exclude Makefile _site/ <NFS_username>@<NFS_ssh_address>:/home/public

This target simply synchronizes the local Jekyll-generated static _site/*</code> directory with the public folder on NFS.net. This set-up allows me to test out changes locally before I publish them.