First Published 03/05/2020
GitHub pages allows you to host your site directly from the repo. It'll build initially with a GitHub url which is great when creating staging or demo sites, but you can also set these up with an Apex domain and run as a live site.
Learn more about GitHub Pages.
The first thing we want to do is tell GitHub that we want to create a site from this repo. To do this head to your repo and then to the settings tab. About half way down this page there's a GitHub Pages option, to create a page you'll need to select a source from the dropdown, by default this is set to None
:
master branch
- choose this option if you want to build directly from the branch.mast branch /docs folder
- choose this option if you have other items in your repo you don't want on the site. For example, I usually compile my 11ty sites into a docs folder.Once you've chosen an option you should see a green box show above this select saying Your site is published at https://[GitHub Userame].github.io/[Repo Name]/
That's it - your site should be ready to use. But what if we want to use an apex domain for this site, such as www.dummyname.com
?
Once your site is built you'll see an option for Custom Domain show underneath, here's where you can add the domain you wish to use for the site. Once you've added this also check the Enforce HTTPS option beneath, I can't think of a reason why you wouldn't want to do this.
<aside> 💡
Note: You will need to perform a pull of the repo after this has been added as a CNAME
file is created in the source directory (either repo or docs folder).
</aside>