how to add a custom domain to your hugo site?

This is an image

This post introduce how to configure an apex domain to your hugo site. A lot of people prefer to have a custom domain instead “http:XXXX.github.io”. Let’s go through the steps to add your domain name to your hugo site:

Step 1: acquire a domain:#

I got my domain name from Google Domains. Depends on different domain names, the prices are different. For example, my domain name “JiaxinZheng.com” costs 12 bucks per year. You can also set up the auto renewal.

This is an image

Step 2: Add a CNAME file#

Once you obtained your domain name, you need to add a CNAME file to the root our your publishing source.

this is an image

Remember to put your domain to the CNAME file: this is an image

Step 3: Configure apex domain#

Navigate to your DNS provider and create either an ALIAS, ANAME, or A record. For more information: Manage Custom Domain.

To create an A record, point your apex domain to the IP address for GitHub pages.

this is an image

✅ Finished!#

After you deploy your site, you have a custom domain for your Hugo Site!

Reference:#

Configuring an apex domain