March 26, 2018 · diy ·

Hosting a Ghost Blog on GitHub Pages

I first began to use GitHub Pages to host my homepage in the start of 2018. I chose GitHub Pages, because it allows me to set the CNAME for my personal domain to mirror the GitHub Pages domain, and it will happily serve pages over the new domain name. By placing a file in the root directory of the repository, GitHub handles all the redirects and correctly serves files.

My homepage was created entirely from scratch, and I used Jeremy Thomas's Web Design in 4 minutes to get a beautiful CSS theme up and running. Learning the basics of HTML5 and CSS3 was valuable, and I'm happy to have learned how to properly use the developer tools in most browsers (learning Javascript is for another time!).

Yesterday, I finally decided to take the time to get my blog functional. I've played around with Ghost in the past, and at one point last year I had set up a Ghost blog on a VPS with nginx serving as a caching proxy. Unfortunately I never got around to consistently blogging, and maintenance of the VPS was an honest pain. Knowing how unreliable I am with taking care of the VPS, I decided that going the static page route was the best choice. Enter Buster, a tool that converts an entire Ghost Blog into a folder for the web server of your choice.

I wrote a short script that when run, will convert the blog using Buster, and then push it to GitHub Pages. If you want to use this script, make sure to use SSH GitHub authentication, and make sure that the directory passed to Buster is a full path.

#!/usr/bin/env bash
python ~/buster/buster/ generate --dir=/home/yoonsik/tmp/blog
cd ~/tmp/
git clone
cd ~/tmp/
git config "yoonsikp"
git config ""
git rm -r ~/tmp/
mv ~/tmp/blog ~/tmp/
git add ~/tmp/*
git rm -f ~/tmp/
git commit -m"$(date)"
git push origin master
cd ~/
rm -R -f ~/tmp/

The obvious benefits to hosting on Github Pages is the price (free) and the zero management required.

Unfortunately, Github Pages has a problem when serving secure content over a personal domain. Github Pages has an SSL certificate for domains that match *, but this certificate won't be accepted for my personal domain. In order to get HTTPS working on the blog, I enabled a Cloudflare proxy for just Cloudflare provides a trusted SSL certificate for my personal domain, and most importantly, has an option to ignore SSL certificate errors on the backend, i.e. the only certificate error.
Update: May 3rd, 2018
Github now provides an SSL certificate for your custom domain. Now, Cloudflare acts only as my DNS nameserver.

Overall, my experience with GitHub Pages and Cloudflare has been stellar, and blog updates pushed to the repository only take a few minutes to become live.