So, the newest version of this blog is using Jekyll. Jekyll is a static site generator. Typically, when you are using one of the large blogging platforms like Wordpress, you use the admin section to add content to the database and when a user visits the site, this content is fetched and built into a page for them to see. Static site generators work a bit different, they actually pre-generate all the pages as html from templates and posts that you have pre-defined. You can either do this locally, and transfer them to your server, or create them right there.

Jekyll offers some advantages over the bulkier blogs, the most obvious of these is speed. When you visit a jekyll site, the web server just needs to grab the files and send them to your visitor. In the same situation, a generic wordpress visit will first be passed off to the php interpretor, which will then run multiple database queries. This means that a flat site will be significantly faster and less resource intensive, allowing you to handle much more traffic at less cost. Due to the generated site is just css, javascript & html, you also have the option of availing of free hosting solutions like github pages (Where jekyll is extremely popular). Being that jekyll is entirely based off flat files, you can also keep your entire blog versioned in the source control system of your choice. With all the actuall work being done away from your web root, and simple flat files being served, you are also removing the possibility of your blogging engine being the weak point of your security.

There are of course disadvantages and limitations, which generally apply to all static generators rather than Jekyll specifically. Firstly, it’s much easier for someone new to blogging to set up a wordpress blog. Many of the cheap hosts out there come with some form of application install service, where it takes even less time to get started than wordpress’ famous “5 minute install”. After that, you just log in and click “New Post”, and it pretty much just works out of the box. With Jekyll on the other hand, you need to install ruby locally, manually create new posts in markdown format, run jekyll build and then FTP the files to your host (Or deploy with git, or set up CI). You will also be limited functionality wise, for example, if you want to allow commenting, you will have to farm it out to someone like DISQUS.

That being said, I enjoy being able to create and edit new posts direct from the terminal, which is probably where I spend most of my time these days anyway, and given how infrequently my bursts of keeping this thing updated, the fact that the actual site won’t typically become more of a security risk the longer I neglect it, is also a distinct advantage.

Setup is relitivly straight forward, the quickstart guide guide covers it quite well, but in summation:

~ $ gem install jekyll
~ $ jekyll new myblog
~ $ cd myblog
~/myblog $ jekyll serve
# => Now browse to http://localhost:4000

The distro I am using shipped with ruby 1.9.something, and jekyll 3 requires 2+, but you can find instructions for updating ruby right here

You will probably want to spend a bit of time configuring it, but at it’s core, each post or page contains metadata at the top of the individual markdown document, this metadata is used to tell jekyll how to structure the pages. What way the folder structure is created, what date to apply to posts and what html to wrap around it. Posts go in your _posts folder, named in the YYYY-MM-DD-post-title.extention format. I have been using markdown, but html (and I believe textile) work just fine too. Pages can go anywhere, either in a sub folder or just in the site root, and pretty much work the same way.

The _layouts folder is where your ‘themes’ live. Each post and page should have a layout value in the liquid metadata at the top, and this is what jekyll uses to wrap the content. These layouts support inheritence, and you can seperate off things like headers or whatever into the _includes directory. Any folder not beginning with an underscore is included in the build of your site.

Ian McCarthy

A 30 something year old Irish developer