Hugo Blogging - Applying a Custom Domain

This post is one of several in the “Hugo Blogging” series. If you haven’t, read the introduction to get started.



Google Domain

  1. Log in to Google Domains.
  2. In your domain dashboard, select the “DNS” tab on the left.
  3. Under “Name servers”, set “Use the Google Domain name servers”.
  4. Under “Custom resource records”, add the following:
    • “A” record
      • Name: @
      • IPv4 addresses:
    • “CNAME” record
      • Name: www
      • IPv4 address:

This is what my resource table looks like:

NameTypeTTLIPv4 Address

Note: it may take up to 48 hours before changes are applied.


  1. Log in to GitHub.
  2. Select your repository. Go the repository “Settings”.
  3. Choose “Options” on the left. Find the GitHub Pages settings.
  4. Set “Custom domain” to your domain. In my case,
  5. Set the branch to gh-pages.
  6. Set the folder to /(root).
  7. Enable “Enforce HTTPS”.

The “Enforce HTTPS” option may not be available immediately.

Hugo Project

  1. Edit config.toml.

    • Change the value of baseURL to your custom URL.

      • Example: baseURL = ""
    • Make sure your project is configure to publish to public.

      • Example: publishDir = "public"
  2. Create a new file at static/CNAME. The only contents of this file should be your domain.

For example, my static/CNAME looks like this:
  1. Commit and push these changes.


245 Words

2021-02-13 02:26 +0000