Nerd-friendly blogging

01 Jul 2011 - webdev jekyll

I’ve been promising myself to write about my blog setup for a while now. As I explained earlier, I use Jekyll – ‘a simple, blog aware, static site generator’. Every time jekyll generates html, it gets dumped to the _site folder. I have my local nginx pointing to the _site folder, so every time I start write blog posts, I open a terminal, go to my blog’s root folder, and run jekyll --auto and hit my nginx install from the browser. This way, every time I save, I get to see what it looks like. I found this much faster than doing jekyll --auto --server and using the server with Jekyll. I version control the whole folder minus the _site folder with git and I’ve set up a bare repo on my server to which this will get pushed too.

Jekyll also runs on my server because I want to be able to blog from any machine from which I have SSH access to my server. I’ve set up the following commit hook on the bare git repo that regenerates the HTML files on every push.

GIT_REPO=$HOME/blog.git
TMP_GIT_CLONE=/tmp/blog
PUBLIC_WWW=$HOME/blog-www

git clone $GIT_REPO $TMP_GIT_CLONE
jekyll --no-auto $TMP_GIT_CLONE $PUBLIC_WWW
rm -Rf $TMP_GIT_CLONE
exit

Its a pretty rad setup. For comments, I’ve setup Disqus, which was quite easy. I set up askimet with them, so that the spam gets filtered, yet to get spammed though (knocks on wood). Overall, the setup has been quite nice and yes very nerd friendly. I can write in my text editor of choice and commit to git with complete rollback history if I want to. Not having an admin panel from which things can be changed is a great benefit!