So, if you’re reading this, you’ve probably discovered that I’ve made yet another change to my website. This one’s quite a big change, certainly in terms of how it’s implemented. In the past I’ve relied on large programs, such as MediaWiki and Wordpress to manage my website. Whilst those are great pieces of software, and good at what they do, they’ve always seemed like overkill for managing a personal website; after all, I doubt very many people ever need to search my blog (and even if they did they’d probably just use Google), so I’ve decided it’s time to move to something simpler.
For the last year or so I’ve been using Git a lot to manage code, and I’ve come to wonder how I ever managed without it and its companion, GitHub. In a short period of time it has almost completely replaced my reliance on Dropbox, and, since it’s easier to roll back a change, it’s made me a bolder programmer (which may, or may not be a good thing…). Since switching to using Linux (almost) exclusively a few years ago I’ve actively looked for easy ways of automating processes. Sometimes I do this successfully, but more often I just spend lots of time discovering new OS features, and end up taking longer to code than the job would have taken by hand. In this vein, and using Git, I decided there ought to be an easier way of managing a website. GitHub Pages is a great example of a way that a website can be managed easily using a git repository, and so I ended up looking into the engine which runs it; Jekyll.
Jekyll’s a fairly light-weight piece of Ruby which generates a static website (so just html files) from a number of different formats, like Markdown and Restructured-text. This means that it has a low overhead on the server it runs on, and should improve the load-times for the pages. Combining this with a few other pieces of open-source code (for example, Twitter’s excellent Bootstrap package) should make for a simple but effective solution.
Using Git’s post-receive hook, a piece of code which runs after a push is received by a repository, it is possible to build the html automatically when the website files are pushed to a remote repository on my webserver.