Josh Gerdes

Host a static Ghost blog on GitHub using Buster

ghost buster

I have really enjoyed the simplicity of the Ghost blogging system and wanted to use it for my personal site. But I also enjoyed the ease of hosting with GitHub Pages so I needed to find a way to generate a static version of a Ghost blog. Luckily someone already had a handy little tool for the job called Buster.

Installing Buster

Details on Buster can be found here. Basically, you need to install wget and git with brew (if they are not already installed on your system) then install Buster with pip. Just run the following commands:

brew install wget
brew install git
pip install buster

To test the install of Buster run the following:

buster --version

You should see current version display (i.e. 0.1.3).

Setting up Ghost

First off you need to download of a copy of the latest version of Ghost found here. Extract the archive and open a console and go to the newly created directory and run the following:

npm install --production
npm start

Then visit in a browser and go through the setup screens to create an admin account and start using ghost.

Setting up Buster

In a new console window go to the directory where ghost is installed and type the following to setup buster:

buster setup

Just follow the prompts and provide the data needed. Please view the README on the Buster GitHub page for more details on how to use Buster.

Generating static pages with Buster

At the time of writing this Buster had some issues with missing the generation of some needed files and creating some files with incorrect URL reference in page. I created this script as a workaround for those issue. So create a file (I called it and be sure and change out the references to and replace them with your remote site URL.


# Generate static files with buster
buster generate --domain=  

# Copy sitemap files
wget --convert-links --page-requisites --no-parent --directory-prefix static --no-host-directories --restrict-file-name=unix
wget --convert-links --page-requisites --no-parent --directory-prefix static --no-host-directories --restrict-file-name=unix
wget --convert-links --page-requisites --no-parent --directory-prefix static --no-host-directories --restrict-file-name=unix http://localhost:2368/sitemap-pages.xml
wget --convert-links --page-requisites --no-parent --directory-prefix static --no-host-directories --restrict-file-name=unix http://localhost:2368/sitemap-posts.xml
wget --convert-links --page-requisites --no-parent --directory-prefix static --no-host-directories --restrict-file-name=unix http://localhost:2368/sitemap-authors.xml
wget --convert-links --page-requisites --no-parent --directory-prefix static --no-host-directories --restrict-file-name=unix http://localhost:2368/sitemap-tags.xml

# Replace urls that were missed by buster
find static/* -name robots.txt -type f -exec sed -i '' 's#http://localhost:2368#' {} \;
find static/* -name *.xsl -type f -exec sed -i '' 's#http://localhost:2368#' {} \;
find static/* -name *.xml -type f -exec sed -i '' 's#loc>http://localhost:2368#loc>' {} \;
find static/* -name *.html -type f -exec sed -i '' 's#u=http://localhost:2368#u=' {} \;  
find static/* -name *.html -type f -exec sed -i '' 's#url=http://localhost:2368#url=' {} \;  
find static/* -name *.html -type f -exec sed -i '' 's#href="http://localhost:2368#href="' {} \;  
find static/* -name *.html -type f -exec sed -i '' 's#src="http://localhost:2368#src="' {} \;  
find static/* -name *.html -type f -exec sed -i '' 's#link>http://localhost:2368#link>' {} \; 

# Add CNAME file for github pages
buster add-domain

# Copy files that were missed by buster
cp humans.txt static/humans.txt
cp -R content/images static/content

Now give the newly created file execute permissions

chmod +x ./

Then just run in the directory where you installed ghost:


This should generate static files under a subdirectory called /static which should be connected to your GitHub repository.

*NOTE: I also forked the Buster repository and made changes to the project to fix the broken URLs and add the sitemap files to the static output. So if you want to use my version of Buster it can be found here. Hopefully my pull request will be accepted shortly and it will become part of the main script.*

Previewing static pages

You can preview the static pages by running the following command:

buster preview

Then visit http://localhost:9000 in a browser to view the static pages locally.

Deploying static pages to GitHub

If you like what you see, you can push those changes to your GitHub repository using normal commands or type the following command:

buster deploy

With luck you should have a nice static version of your site published to GitHub to enjoy.