Converting BlogCFC Posts to Markdown

Posted on October 6, 2018

I’d been trying to convert this site away from BlogCFC for some time. After investigating a few blogging platforms, I decided on the simplicity of a Jekyll static site via Github Pages. Ultimately I choose Gitlab Pages, but before I talk about that, here’s how I converted my posts.

Query for BlogCFC Posts

BlogCFC is a ColdFusion based blogging application that works a few databases out of the box. The SQL in this script is targeted at MySQL.

Converting Content

This part of the script begins removing common HTML and converting it to the equivalent markdown syntax. For example,

<h1>Header</h1>
# Header

Saving Markdown Files

Finally, the posts can be output and saved as markdown files. The area wrapped with three dashes --- at the top of each file is called YAML front matter. It contains configuration variables for each post as needed.

The date setting, for example, does not need the time or timezone if you so choose. Its value powers the Posted on {date} line under the title of each rendered post. I’ll discuss these further, as well as differences between Github and Gitlab Pages in an upcoming post.

Cleaning Up

You can pretty much use the resulting markdown files at this point. Since overall, I didn’t have a high volume of posts, I decided to do some cleanup of the HTML and decided to sunset some far-outdated posts (who talks about Flex anymore? Honestly.). I’ve switched almost exclusively to VSCode as an editor. There are a number of plugins that helped with this process:

Quick Note on Code Sections

All code sections are opened with ```cfscript and closed with cfscript```. The opening syntax triggers code highlighting by Rouge, the closing syntax was an attempt at finding the related closing marks for each section. You’ll want to go through and replace ```cfscript with the correct language for each section of code and then replace cfscript``` with just ``` to ensure the code is formatted correctly.

Regarding Old Comments

I’m using Disqus to manage comments now. I’ve got a backup of all the comments as part of the old site’s database, but I didn’t think it was worth porting them into Disqus. Ray Camden tackled this effort when he moved off of BlogCFC (did I mention he created it?) years ago.

Now I can enable comments via Disqus simply by adding comments: true to the YAML front matter on a post by post basis.

Final Thoughts

It was relatively easy to convert from BlogCFC to Markdown. Learning the ins and outs of Jekyll was annoying at times, but after a short while it all started to click. I’ll post more about the process of getting the site live on Gitlab Pages, but if you have any questions about the process so far, leave a comment below.

About the Author
Adrian J. Moreno

Adrian is a CTO and solution architect specializing in software modernization. More information