Hosting Ghost websites for free

Mostly personal notes on building and maintaining this website.

TLDR

I use ghost as the backend cms to manage all my posts. I have a custom script that converts my website into a static website that can be hosted for free using github pages.

Setup

Setting up ghost is super simple, I use ghost-cli. Install instructions are here. Create a new directory for your website (mkdir my_website), and run ghost install local inside it — that should allow you to view a locally hosted website.

Building the static website

Download the make_website function from here and place it inside your fish functions folder (.config/fish/functions/make_website.fish). Then go to the parent directory of your website and run the following.

$ make_website <http://localhost:2369> vimalmollyn.github.io vimal-mollyn.com

This should make a new folder in the parent directory called vimalmollyn.github.io which you can push to github.

Modifying themes

Navigate to my_website/content/themes/<theme-name> and run npm run dev inside it. That should allow you to modify the theme and see changes live. Otherwise, you’d have to restart ghost each time you made a change to the theme to notice the change.

Modifying routes

Follow tips from https://ghost.org/docs/themes/routing/#tips and upload the latest routes.yaml to the website.