I have decided to ditch Wordpress and all activities that come with it (plugins, scripts, hosting maintenance etc.) and to move to GitHub Pages.

GitHub Pages offer very easy, fast and clean environment if you have blog similar to mine where you mainly post text based (with few images now and then) posts.

I will explain the steps I took to configure Jekyll and setup GitHub Pages.

  • You need to have GitHub account. If you don’t have one you can create at GitHub
  • Create public repository named username.github.io
    • In general the repository needs to be public. I have read that you can have your repository private if you have paid plan, but I haven’t tried it.
  • Go to Jekyll installation page to learn how to install Jekyll and to get familiar with the framework.
  • Once you have Jekyll installed (I installed in on an Ubuntu VM) you need to create your site structure with:
jekyll new myblog
  • Push the folder contents to the GitHub repository you created in step #2. I use GitHub Desktop on daily basis to push/pull changes to/from GitHub.
  • Open your favourite browser and go to username.github.io

Now, you should be able to access your page via username.github.io

  • By default GitHub Pages uses minima theme (that’s what I use as well).

Custom domain

If you want to use custom domain for you site, like I do, then you need to let GitHub know what domain/subdomain you want to use and update your DNS settings.

Provide your domain/subdomain to GitHub Pages via your_repository -> Settings -> GitHub Pages -> Custom domain. This will create CNAME file in the root directory where it stores the custom domain information.

At this point you won’t be able to Enforce HTTPS

Apex domain

If you want to use an Apex domain for you site (i.e. no subdomain) then you need to put an A record in your DNS configuraiton to point the IP addresses for GitHub Pages.

More you can read at Configuring an apex domain

Subdomain

If, like me, you want to use subdomain for your site then you just need to create CNAME record in your DNS configuration to point to username.github.io

More you can read at Configuring a subdomain

Once you have properly configured Apex domain or subdomain you can enforce HTTPS for your site. To do that you need to go to your_repository -> Settings -> GitHub Pages -> Enforce HTTPS

Posts migration

The migration of the posts was done manually. I did not bother to automate that part of the process. It also gave me a chance to clean some of the posts.

Comments

For comments I decided to use Twitter. On each post (at the end of the post) there is a link comment which if clicked will redirect to Twitter. The link contains pre-defined text (the post url) which gets pushed into the compose tweet box. The downside is that you need to be already logged in on Twitter in order for the link to work. It seems that Twitter will not redirect to login page if you’re not singed in.

You should be able to easily integrate Disqus comments but since I don’t have an account there and I want to simplify the things I decided to go with Twitter.

Update 10.11.2019:
I found a proper construct for the comment link so that it does not break if you’re not logged in to Twitter.

How do I create blog posts?

In order to publish a blog post I simply open my favourite editor (Visual Studio Code) write my post in Markdown (and/or HTML) syntax and commit to GitHub.

To create a post, add a file to your _posts directory with the following format:

YEAR-MONTH-DAY-title.MARKUP

Each post needs to have metadata definition at the top defined as:

---
layout: post
title:  "_post_title_"
date:   _post_date_
categories: _post_category_
---

You can read more at Posts.

For example, to format code blocks you use Liquid tags ( without the \ ):

{\% highlight sql \%}
_code_
{\% endhighlight \%}

That’s it. The site will automatically build itself and publish the post. In case of an errors you’ll receive Page build failure email with details on what line it failed. You’ll have to fix the error and commit again (which will trigger new build). In case of Page build failure you’re site will be still available, you just won’t see the new changes!

PageSpeed Insights