SETTING UP CUSTOM DOMAIN FOR A ‘GITHUB PAGES WITH JEKYLL’ SITE IN THE RIGHT WAY

SETTING UP CUSTOM DOMAIN FOR A ‘GITHUB PAGES WITH JEKYLL’ SITE IN THE RIGHT WAY

2020, Jan 19    

Recently I ditched WordPress CMS and moved two of my websites to GitHub Pages. I used Jekyll a simple, blog-aware, static site generator for both of my websites. Setting up the sites was quite easy, however figuring out the right way to configure the custom domain (with https enabled) on GitHub Pages took me some time. So, here I am to save your time and show you how to get it right –

1. Setting up custom domain on GitHub Pages setting

Set up custom domain on GitHub Pages as shown below. Make sure you are not typing www before your site name. And check “Enforce HTTPS”.

Image

2. Setting DNS Host records on your domain name provider’s portal

Go to your domain name provider’s website and set the records as shown below. Setting up CNAME with username.github.io is particularly important. Otherwise if someone types www before your website name, the browser will not be able to show the website. At the time of writing this post, GitHub Pages is using the below IP Addresses for A records. But it will be a good idea to check if there has been any change in these IP addresses. You can check it in this GitHub Help page.

Image

3. Edit YAML file

Add/update baseurl and url keys of your config.yml file as below.

baseurl: # the subpath of your site, e.g. /blog. If it's not relevant for your site, keep it blank.
url: "https://www.example.com" # the base hostname & protocol for your site.

If you follow above steps correctly, your site should be up and running shortly. Good luck!

Image credit: https://guides.github.com/features/pages/


Love traveling? Visit my travel picture blog Tales of Trails