kentnek tech blog

How This Blog Went Live

After writing on Medium for some time, I realized I needed a better blogging platform, since Medium has several limitations:

A friend of mine suggested that I look into the Jekyll + GitHub Pages combination. At first, I was hesitant because creating a new Jekyll-powered blog seemed quite a bit of work; I just wanted something simple so I could focus on the writing.

However, after trying out this awesome guide on Jekyll, I was immediately hooked on the concept of static site generators.

I can simply write a post in Markdown, and Jekyll will automatically pass it through templates then output a complete static website. Used alongside GitHub Pages, the static website is conveniently served from the GitHub repository, making private hosting unnecessary.

Now, what can be a better way to start than writing a blog post on how this blog itself goes live?

Find a nice theme

A quick Google search leads to this list of themes on Jekyll’s repo. This looks good:

Lagrange Theme

The Lagrange Theme, by LeNPaul

I then clone the repository to a local folder: ~/blog.

Install Jekyll locally

This is the step that initially deterred me from trying Jekyll.

Mind you, I’m using Windows, and the installation guide for Windows looks incredibly painful. Also, I don’t want to install Ruby and a dozen of other dependencies just for Jekyll.

Therefore it’s the perfect opportunity to turn to Docker, on which I’ve been relying to simulate Unix and avoid cluttering my Windows with dependencies from various projects.

Thankfully, the awesome people behind Jekyll have already made a nice Docker image, so let’s jump right in and create a docker-compose.yml file inside ~/blog:

jekyll:
    image: jekyll/jekyll:pages
    command: jekyll serve --incremental --force_polling
    ports:
        - 4000:4000
    volumes:
        - .:/srv/jekyll

Note the jekyll serve command and its --force_polling parameter, which I found to be necessary for Jekyll’s auto-generation-on-file-change feature to work in a Docker container on Windows.

Finally, inside ~/blog, run docker-compose up -d and the site is immediately available at localhost:4000. Sweet.

Write away!

I tinker with the CSS included in the theme, modify the contents of the templates, and add the ability to caption pictures. I can do all these from the comfort of my favorite IDE, which is really awesome.

After customizing the blog to my liking, I can finally concentrate on writing this blog post, which turns out to be a very pleasant experience, thanks to Jekyll taking all the hard work in parsing and formatting it.

Upload to GitHub Pages

By the time you can read this post, I have successfully committed and pushed ~/blog to GitHub Pages, where Jekyll automatically runs and exports the whole thing into a nice static website.

And yay, that’s it for the first blog post :]