So you want a custom domain name?

Here is a step-by-step guide to how to get one (for free) from freenom. I use github pages to host my hugo website so the tutorial will focus on the relevant steps.

  1. Check availability of a domain name

In the search bar, type out the site name that you want, say example.com. It should give you a few alternatives such as shown in the picture. Pick your favourite. If you are a first time user, create an account with freenom and proceed to checkout.

NOTE: Sometimes, you may get an error when you hit Get it now! which says not available. Don’t worry, just search again with the same domain name but with the exact extension that you wanted. So if the alternative was example.ga search again with example.ga. The problem should be resolved 😄

  1. Alias records in your DNS provider

In freenom, under Services dropdown, go to My domains and select manage domain. You must provide an alias record for your github website. Go to GitHub pages documentation to find the ip addresses that correspond to your GitHub page domain name. In my case they are:

185.199.108.153
185.199.109.153
185.199.110.153
185.199.111.153

Navigate to manage freenom DNS and enter this information in the prompt as follows: DNS records

Notice the last CNAME entry. This entry should point to your original user site. Make sure it is of the format <user>.github.io.

  1. Add CNAME file in github

In the settings of your github repo, in the code and automation submenu, go to pages. Put your recently acquired domain name under Custom domain. (If the previous steps work, you can also enable enfore HTTPS).

GitHub pages records

  1. Edit config.toml baseURL

Go to config.toml and change baseURL to your new custom domain name. Build the website, push the changes and…

  1. Wait!

DNS entries take some time to propagate across the internet. It took my website about 10 minutes to load correctly. Once its done though, it works like a charm 😄