Simplest way to host your Ghost blog on GitHub Pages
This tutorial assumes you already have a Ghost blog that you want to host on Github Pages.
- Follow these instructions to create a repository for your Github Pages blog, and then clone the repo somewhere on your computer;
- Go to the directory where you have your Ghost blog, run
ghost start
and take note of the local port; - Install ghost-static-site-generator;
- If your blog is running on the default port (2368), you can simply run from your Ghost blog's directory:
gssg --url [your-github-pages-URL]
if you're running from some other port you can specify it with the domain
parameter:
gssg --url [your-github-pages-URL] --domain http://localhost:4444
5. If everything went smoothly you now have a directory called static inside your Ghost blog's directory. You can check if everything went well by running:
gssg preview
6. Copy all of the contents of the static dir to the Github Pages repo, commit + push these new files and you're done!
Note that instead of copying the files, you can set the Github Pages repo as the destination directory as such:
gssg --url [your-github-pages-URL] --dest your-github-pages-repo