This website https://seregayoga.com is built on Hugo static site generator and hosted on Github. There are two tutorials from Hugo and from Github on how to configure it. Here is the gist of them on how to do the same on your own domain name. Assuming it is example.com and your Github profile name is your-github-profile.
- Create a Hugo website. You can take a look at official quickstart guide.
- Create a public Github repo and push the code there from the previous step.
- Verify your custom domain. At this step you will be adding a
TXTDNS record. Do not close web interface of your DNS provider; you will need it for the next step. - Continuing configuring DNS: add four
Arecords to point your domain to Github servers:
185.199.108.153
185.199.109.153
185.199.110.153
185.199.111.153
Additionally, if your DNS provider supports IPv6, add four AAAA records:
2606:50c0:8000::153
2606:50c0:8001::153
2606:50c0:8002::153
2606:50c0:8003::153
And finally add a CNAME record with name www.example.com and value your-github-profile.github.io.; by doing this you will have a redirect from www.example.com to example.com.
Verify you did everything right by following dig commands:
$ dig www.example.com +noall +answer -t A
www.example.com. 2872 IN CNAME your-github-profile.github.io.
your-github-profile.github.io. 2872 IN A 185.199.111.153
your-github-profile.github.io. 2872 IN A 185.199.109.153
your-github-profile.github.io. 2872 IN A 185.199.108.153
your-github-profile.github.io. 2872 IN A 185.199.110.153
$ dig www.example.com +noall +answer -t AAAA
www.example.com. 2869 IN CNAME your-github-profile.github.io.
your-github-profile.github.io. 2869 IN AAAA 2606:50c0:8000::153
your-github-profile.github.io. 2869 IN AAAA 2606:50c0:8001::153
your-github-profile.github.io. 2869 IN AAAA 2606:50c0:8003::153
your-github-profile.github.io. 2869 IN AAAA 2606:50c0:8002::153
$ dig www.example.com +noall +answer -t CNAME
www.example.com. 2866 IN CNAME your-github-profile.github.io.
- Go to settings of your Github repository, then
Pagesand inBuild and deploymentsection in theSourcedropdown chooseHugoand click onConfigure. Github will provide you with a Github Actions config file, simply commit these changes to your repository. - At this step you might already close
Pagessettings page, if so open it again. There inCustom domainspecify yours, in our case it will beexample.com. You should seeDNS check successfulbadge meaning you did everything right in steps 3. and 4. Make sureEnforce HTTPScheckbox is checked so Github will take care of enabling https. - VoilĂ ! Now you can enjoy your website powered by Github Pages on your own domain.