Nur Rony
Polyglot Programmer, DevOps and Forever Learner

Publishing Ghost Blog to Github Pages

Publishing Ghost Blog to Github Pages

I like simplicity. I also believe that simple things are really beautiful. I recently migrate my blog from Wordpress to Git pages. It gives me ultimate freedom to customize my blog. I am a NodeJS guy and a great fan of Markdown. I choose Ghost for publishing my blog to Git Page. But Git only host the static page. So I use Buster to generate static content from Ghost blog.

Prerequisites

I am assuming that you have these following things installed in your machine:

  • You are on Ubuntu or *nix machine
  • You have git installed on your machine
  • NodeJS >4.2.4 and NPM (comes with NodeJS).
  • You already familiar with Ghost and know how to setup, configure and run custom installation.
  • Have Buster installed on your machine.

Setup Git page

  • Create a repository .github.io
  • Go to your Ghost root directory on your local machine.
  • Run the following command in your terminal to clone your .github.io in static directory in your Ghost root directory on local machine.
git clone git@github.com:<your-github-github-username>/<your-github-username>.github.io static

Download Deploy script

To make the deployment process easily with Buster I have already created a deployment script for it.
To download the script run the following command on terminal from your Ghost root directory.

curl -fsOSL https://gist.githubusercontent.com/nmrony/77147308e38776031412/raw/ghost2git && chmod +x ghost2git  

Open the git2ghost script in your favorite editor. Find and replace <your-github-username> with yours.

For more please see the README of the Gist

Now after publishing a post in your local Ghost blog you can deploy it just running ./ghost2git from your local ghost root directory.