Deploying to GitHub, then Custom Domain; what baseurl?

I am able to host my Hugo website on GitHub following these instructions to deploy to the /docs folder. The site now appears at username.github.io/projectname/

However, I would now like to host this site on a custom domain, custom.domain.com.

I’m arranging for the CNAME to forward to username.github.io/projectname/, but I’m a bit confused about what to use as my baseurl in my config.toml file.

Should this be username.github.io/projectname/ or custom.domain.com? It seems like whichever one I choose, the other URL will not have appropriate hyperlinks to css files (as arranged by my Hugo theme, which seems to use the baseurl to determine paths). Is there a way for it to render properly in both?

Thanks!

If you have set up your Github Pages to host on your custom domain then set the baseurl to the custom domain.

Unrelated but I’d just go with Netlify… they provide https on custom domains too while Github Pages doesn’t… and also is really painfree to set up compared to Travis CI + git branches + Github Pages.