- Host on GitHub for free
- No backend
- No database
- Can use a custom domain (In my case I'm using a custom subdomain)
- Supports HTTPS
This is how I setup my blog blog.chadalen.com.
- Setup Gatsby Project
First, create a Gatsby project. (I'm assuming if you're reading this you know what Gatsby is.)
2. Setup GitHub pages
Gatsby has good documentation on how to do this. (See here)
3. Setup Custom Domain
On your DNS provider create 4 A records and 1 CNAME record (Github Docs)
4. Configure GitHub Pages
Next, we need to create a file in the root of the project named "CNAME". Inside that, put the url of your custom domain. In my case I put "blog.chadalen.com"
Lastly, go into your repository settings on GitHub. Look where it says "GitHub Pages", under there enter your custom domain. If you're not able to select "Enforce HTTPS" you might need to wait a few minutes, if you still can't select it make sure your domain has the 4 A records.
That's it! Now you can create a free website with React and Gatsby hosted on GitHub Pages!