I’ve started this blog to begin recording my thoughts around my experience with delivering software.
I’m a big fan of automating software so it makes sense that I write up how I automated the blogging platform I’m using.
There is certainly no shortage of tools for blogging but before I start throwing code at the solution I had some requirements to think about:
- The blog posts should be in source control
- The posts to be in markdown so they are not coupled to one particular blogging platform
- The site should automatically update upon changes being checked into source control
With the above in mind I narrowed my selection to static site generators, of which there are plenty, for example Hugo, Jekyll, Ghost.
After spiking all three I liked them all but found Jekyll the easiest to get things cooking so decided to go with that. As the posts are in markdown it should be fairly simple to change this later but for now I wanted my blog up and running.
I installed Jekyll on both a Windows and my macOS. The Windows install and setup was very simple but I wanted to use my Macbook Air (MBA) as my main machine for blogging as it’s so portable. Setting Jekyll up on a MBA is a little more involved and requires jumping through a few more hoops.
Install Ruby (attempt 1)
macOS already has Ruby installed but the general wisdom is to not mess with this installation and use a Ruby environment manager when writing Ruby on OS X.
Right, rbenv it is then.
To install this I used homebrew
brew update brew install rbenv
But it’s not as simple as just that, once installed rbenv should be initialised:
And the instuctions from the above:
# Load rbenv automatically by appending # the following to ~/.zshrc: eval "$(rbenv init -)"
So the shell needed bootstrapping, in my case I use Oh My Zsh so I edited my .zshrc file with nano and added the above line.
Install Ruby (attempt 2)
Alright! Now to install the latest stable ruby:
rbenv install 2.4.1
Verify the version:
ruby -v ruby 2.4.1p111 (2017-03-22 revision 58053) [x86_64-darwin16]
Finally! we can install Jekyll.
gem install jekyll bundler
Now create the site
jekyll new blog.laver.io
This creates a new folder with the site in, we can navigate to the root of the site:
Build and Serve site
To generate the static site and serve it locally:
bundle exec jekyll serve
Browse to localhost:4000
Excellent - now time to write some posts, install a theme and tweak the settings.