Background

Since my website is online for a while, I was thinking to use my name as the domain name to replace the username.github.io so that my networks can find me easier.

Today I was learning AWS route 53 service for AWS Certificate and I took this chance to register my domain xiahe-bleinagel.com. It cost 13$ per year. There are many other options to purchase a domain name, like GoDaddy, Namecheap, etc.

Changes in the Source Repository

Buying a domain name is the first step. In my Hugo repository, I need to make the following changes:

  • Add a CNAME file under the static folder, in the CNAME file should only contain the custom domain name.

  • Change baseurl in config.toml from baseurl=“https://data-think-2021.github.io” to baseurl = “https://xiahe-bleinagel.com

  • Rebuild the site. $ hugo

  • Push the rebuilt ./public directory to my data-think-2021.github.io repo

  • Go to my repository in Github, and click setting -> pages. Scrow down to enter the custom domain and enable HTTPS. HTTPS provides a layer of encryption that prevents others from snooping on or tampering with traffic to your site. Github pages

DNS Records Configuration

Configuration

  • Create A records, map my apex hostname to IPv4 for Github Pages:
185.199.108.153
185.199.109.153
185.199.110.153
185.199.111.153
  • Create CNAME record that points www.xiahe-bleinagel.com to the default domain for my github page: data-think-2021.github.io. Don’t include the repository name.

Screenshot of my DNS records

What is DNS?

Domain name system (DNS), translates human-friendly hostnames into the machine IP addresses.

The following diagram explains how DNS routes traffic to the website. How DNS Route Traffic to your website
Read more and picture source from amazon doc

Records are how you want to route traffic for a domain. Each record contains the domain/subdomain name, record type, value, routing policy, and TTL.

Record Types

  • A – maps a hostname to IPv4
  • AAAA – maps a hostname to IPv6
  • CNAME – maps a hostname to another hostname
  • NS – Name Servers for the Hosted Zone

Once those changes are implemented, just give a bit of time to verify the DNS check. Then you can visit the website with the custom domain name.

Reference

❤️ Please visit my home page to find more contents. I am happy to connect with you via LinkedIn.