custom domain name in github pages with hugo
Custom github domain name configuration with hugo #
I decided I wanted to setup a custom handler for an endpoint for hugo to github pages rather than the https://bowdena.github.io/ephemera.reify.au that I was used to and instead resolving to https://ephemera.reify.au.
I thought that this would be an easy CNAME entry into my DNS host but it turned out to be a little messier than that.
Firstly, I followed this guide Managing a custom domain for your GitHub Pages site. At the bottom, there was this handy dandy table that I thought I could just follow and enter the CNAME type of entry for:
| Scenario | DNS record type | DNS record name | DNS record value(s) |
|---|---|---|---|
| Apex domain ( example.com) | A | @ | 185.199.108.153185.199.109.153185.199.110.153185.199.111.153 |
| Apex domain ( example.com) | AAAA | @ | 2606:50c0:8000::1532606:50c0:8001::1532606:50c0:8002::1532606:50c0:8003::153 |
| Apex domain ( example.com) | ALIAS or ANAME | @ | USERNAME.github.io orORGANIZATION.github.io |
| Subdomain ( www.example.com,blog.example.com) | CNAME | SUBDOMAIN.example.com. | USERNAME.github.io orORGANIZATION.github.io |
I went to the repo -> pages and update the custom domain section so that it looked like this:
Once I had finally redeployed, I was getting errors on the page, it would render without any of the css or js stylesheets. The developer console showed the error the page loaded over HTTPS but requested HTTP
I thought that it was related to my hugo.toml file, but in the end I came across this post that mentioned that github has a different deployment than the toml configuration. Sure enough, in the default .github/workflows/hugo.yml file I found the stanza:
| |
I went to the github workflow and found that sure enough, the site was being deployed to http rather than https
The solution was to tick the Enforce HTTPS box in the github pages location and the redeploy
