Important: I have moved to fastpages. fastpages is the best option is you want to write jupyter notebook and share them as posts. All the details of setup are provided on the fastpages homepage.

The website looks as shown below:

My system info

  • Ubuntu 20.04 LTS
  • Ghost 3.15.3
  • Yarn 1.22.4
  • Nodejs 12.16.3

Short summary of what we are going to do.

  1. Install Ghost locally from source
  2. Use default casper theme to make the website
  3. Generate a static site using gssg
  4. Host the static site on Github

Install Ghost locally and it's dependencies

  1. Install NodeJS. (v12 is the recommended for Ghost).
    curl -sL | sudo -E bash
    sudo apt install -y nodejs
  2. Install Yarn.
    curl -sS | sudo apt-key add -
    echo "deb stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
    sudo apt update && sudo apt install yarn
  3. Install Ghost from source. (The official setup guide can be found here Note: Replace KushajveerSingh with your Github username.
    git clone --recurse-submodules
    cd Ghost
    cd core/client
    cd ../../
  4. This is a hack. If you follow the official setup guide then you would have forked the Ghost repo and added that as your upstream in the previous step.

    I skipped that step, as I was having some problems with that. Instead I deleted the .git folder and initialized a new github repo for version control.

    So go the main Ghost folder and delete .git folder. Then go to core/client and delete the .git folder and submodule file and you are done.

  5. Install dependencies (We are in home directory of Ghost)
    sudo npm install
    sudo npm install -g knex-migrator
    knex-migrator i
  6. Make your Ghost folder a github repo.
    1. Goto Github and create a new repo where you want to store the Ghost folder.
    2. In the Ghost folder run these commands to push it to github.

Create website using Ghost

Use npm start to start the Ghost server. This will open the server at http://localhost:2368.

Goto http://localhost:2368/ghost from where you can start creating your website.

Now create your website locally, and when you are done move to the next step.

Download ghost-static-site-generator

This is the tool that we will use to get a static site out of our Ghost site. You can check the official github repo of the package for more details on the usage.

To download the package run npm install -g ghost-static-site-generator. If you get errors run this command again. I ran this command twice and it worked. Maybe try sudo if it still not works.

Now you can create your static site using gssg --url= and it will create a static folder in your current directory, from where you can copy the contents to your repo.

Automating the above process

To automate the complete process and ensure that my Ghost repo and repo are in sync, I created this script.

# Change git_folder, ghost_folder, url
# git_folder -> location of your repo
# ghost_folder -> location of the Ghost folder in which you are creating your site
# url -> The github address where your website will be published

# Remove all contents of git_folder
rm -r $git_folder/*

# Generate static site using ghost-static-site-generator
# The contents of the site are directly placed in the git_folder
gssg --url $url --dest $git_folder

# Commit the changes of git_folder
cd $git_folder
git add -A
git commit -m "$1"
git push origin master

# Commit the changes of ghost_folder
cd $ghost_folder
git add -A
git commit -m "$1"
git push origin master

You need to change only git_folder, ghost_folder and url as per your requirements.


./ "initial commit"

Your repositories will be pushed to Github with the provided commit message.