Retiring Ghost

misc jasper
May 18, 2021 / Robert Zehnder

Ghost CMS is great, but it is overkill for my needs, so it was time to come up with something lighter.

Cover

I have been using Ghost CMS for my blog for almost exactly one year; my first post on Ghost was on May 19th, 2020. I proclaimed it was time for a hard reset of the blog. Honestly, looking back on that post it looks like I was previously running a Ghost blog, but I lost access to the previous server and instead of trying to fix it I just decided to start over from scratch. The current incarnation of my blog has been happily running for the last year.

The downside to the current setup is cost. It costs me just as much to run my blog as all my other instances combined. It is not a major cost, but if the blog could run on a server I already have, that would be awesome. There are a few options in ColdFusion for content management, but most of them are very complex. I thought I would try to come up with my own solution.

How it started

Back in March, Raymond Camden had a blog post about how he creates content with Eleventy. I think what stood out the most was how easy it was to create a blog post; just create a markdown file. Publishing the post is a matter of commiting the changes to the git repository and Netlify will pick up the changes and rebuild the blog.

How it is going

Reading Ray's post gave me a few ideas.

What I like about static site generators is how easy it is to create a post. I just want to create a blog post by creating a markdown file. I created a posts/ folder to hold the markdown files. The file name determines the post slug so I know exactly where to view the post.

Next, front mattter is required to get meta data for a post. This is accomplished in ColdBox using the cbyaml plugin. The processor can be very unforgiving when parsing the front matter, but errors will be caught before deploying to production, not after.

Finally, markdown is converted to html using the cbmarkdown module.

Tech stuff

No database is required because all the information needed is stored in the markdown front matter. The post list will be loaded and cached on the first view. Post front matter and markdown will be loaded and cached on the first view as well. All subsequent requests will be pulled from cache instead of reading from the file system.

Filter by tag works by actually using filter() to filter the post list by tag.

Since this is not a static site generator I do not need to rebuild the blog, I just need to commit the new markdown files to the repository. When those changes are pushed to GitHub, a webhook is fired that tells ColdFusion to git pull to get the latest changes. Once that is done, cache is cleared, and the blog is up to date.

You can check the code out here.

Cover image by Stefano Pollio on Unsplash

About Robert Zehnder
Robert is a Senior Lead ColdFusion Engineer. In his spare time he enjoys hanging out with his family, his dog, and working on cool stuff.