Setting up a Hugo site on GitHub Pages has been a bit of an adventure. I’ve finally managed to get my configuration up and running the way I want it. The biggest challenge was getting my custom domain set-up.
This site really helped me with how to set-up the files to support the customer domain. One gotcha was adding the CNAME file to the Hugo repository under the static directory. If you don’t do that, Github will add one for you when you set up the custom domain, but it doesn’t seem to work, as I think it’s not putting it in a place Hugo recognizes when you build your site. You have to add it to the repository.
The other clarification is setting the baseURL. The CNAME file will include only the custom domain. But the baseURL setting in Hugo needs to include the protocol and a trailing forward slash.
So in my case:
Hope that helps.