benson.vc instead of the default username.github.io URL.
How it works
The custom domain setup involves two key components:- CNAME file: Tells GitHub Pages which custom domain to use
- DNS configuration: Points your domain to GitHub’s servers
CNAME file
The repository includes aCNAME file in the static/ directory:
How Hugo handles the CNAME file
During the build process:GitHub Actions deploys
The workflow pushes
public/ contents (including CNAME) to the gh-pages branch.DNS configuration
To point your domain to GitHub Pages, configure your DNS records:For apex domain (benson.vc)
Create A records pointing to GitHub’s IP addresses:For www subdomain
Create a CNAME record pointing to your GitHub Pages URL:Verifying your custom domain
After configuring DNS, verify your setup:Check GitHub Pages settings
Go to your repository’s Settings → Pages. You should see “Custom domain: benson.vc” with a checkmark.
Enabling HTTPS
GitHub Pages provides free HTTPS for custom domains:baseURL configuration
Ensure your Hugo configuration uses the custom domain:config/_default/config.toml ensures all internal links and canonical URLs use your custom domain.
Troubleshooting
Domain not working
- Verify the CNAME file exists in
static/CNAMEand contains onlybenson.vc - Check that DNS records are configured correctly
- Ensure GitHub Pages is enabled and set to deploy from the
gh-pagesbranch
HTTPS not available
- Wait for DNS propagation (can take up to 24 hours)
- Verify that GitHub Pages has verified your domain
- Try removing and re-adding the custom domain in repository settings
Old content showing
- Clear your browser cache
- Check that the latest deployment succeeded in the Actions tab
- Verify that
baseURLin your Hugo config matches your custom domain
Maintaining the custom domain
The CNAME file is automatically included in every deployment because:- It’s stored in
static/CNAMEin your source code - Hugo copies it to
public/CNAMEduring build - GitHub Actions deploys
public/to thegh-pagesbranch
static/, your custom domain will continue working.