Moved to Ghost

Background

I originally created my blog with Jekyll for the past few years. Jekyll is an amazing static-site generator created with Ruby; it gives you full control over the templates, markdown, and more.

However, I recently found Ghost. Ghost is a paid publishing platform which also offers their platform as open-source on Github.

What I like about Ghost is it's beautiful administration panel that lets me just focus on writing (in Markdown). It comes with a lot of features and plugins; like integration with Unsplash, featured image support, basic Markdown tools, meta modifications, excerpts, spell checking, tag tracking, live previews, etc.

I took the plunge and decided to move.

Moving

First, I wrote a quick script to convert the Markdown files into a Ghost-compatible JSON file for import.

Essentially taking the YAML frontmatter that Jekyll uses, moving it into a JSON file, and uploading it into Ghost's administration panel.

For images, I simply dropped them right into the content/images of the Ghost installation.

Static Generation

So one problem, Ghost is writtin in NodeJS and is meant to be run on a server. It is not a static generator like Jekyll.

Using a tools, like Buster, we can overcome this problem fairly easy.

Buster

You can install Buster; a simple static-generator for Ghost which crawls the Ghost installation using wget and produces a static structure ready to upload to Github pages or other static hosting providers.

Its a simple as using your terminal to move into the Ghost installation, and typing pip install buster, followed by buster setup.

Buster Clean-Up

Buster produces raw files... no fixing for domain names, HTTPs, and all files and anchor tags are preserved to use ".html" at the end.

I modified a script from StefanScherer/ghost-buster-docker to fix the domain names, move all http to https, clean up .html from links, and more. You can view the Gist here.

Save it to your Ghost installation was buster.sh and be sure to give the file the correct permissions to run. Also, change my domain name for your domain name.

Next, create a folder inside your Ghost installation:
mkdir static; mkdir copy

  • static is where Buster will generate the files.
  • copy is where you wish to place files to be copied over after Buster has ran (README.md, CNAME, etc).

Now, start Ghost up with npm start. Once started, run ./buster.sh --deploy.

The script will clear out the static folder, run the static generation, fix all the links within the HTML and sitemaps, clean up any cruft, copy the files over from copy, and push the result to Github.

Thats it! Ghost > Static Generation > Github Pages. I'm really enjoying Ghost thus far, and I hope you too will check it out.


Cover image credit: Toa Heftiba

Show Comments