Let me tell you the story of my blog.
It started back in 2009. Like everyone back then, I started on Blogger as it was the easiest way to start a blog and get it hosted for free. Pretty soon, however, I wanted to have my domain and start owning my content.
That brought me down the rabbit hole of blog engines. Most engines back then were SQL based (SQL Server or MySQL) thus increasing the cost.
My first blog engine was BlogEngine.NET. After a few painful upgrade, I decided to go to something easier and more straightforward. So I went with MiniBlog by Mads Kristensen. Nothing fancy but I still had some issues that left me wanting to change yet again.
So this led me to think. What were the features in those blog engine that I used? I sure wasn’t using the multi-user support. I’m blogging alone. As for the comments, I was using Disqus for years now due to centralized spam management. What I was using was pushing HTML and having it published.
That’s a concise list of features. I asked the question… “Why am I using .NET?”. Don’t get me wrong; I love .NET (and the new Core). But did I NEED .NET for this? I was just serving HTML/JS/CSS.
If I removed the .NET component what would happen?
First, I don’t have to deal with any security to protect my database or the framework. In my case, .NET is pretty secure, and I kept it up to date but what about a PHP backend? What about Ruby? Are you and your hoster applying all the patches? It’s unsettling to think about that.
Second, it doesn’t matter how I generate my blog. I could be using FoxPro from a Windows XP VM to create the HTML, and it would work. It doesn’t matter if the framework/language is dead because it’s not exposed. Talk about having options.
Third, it doesn’t matter where I host it. I could host it on a single Raspberry PI or a cluster, and it would still work.
That’s what this blog post is about. It doesn’t matter what you use. All the engines all use the same files (mostly).
First, I’ll take a copy of my blog. You could use yours if it’s already in markdown, but it’s just going to be an example anyway. Mine uses Hexojs. It doesn’t matter unless you want to keep the template.
What is important are all the markdown files inside the folder
I’ll clone my blog like so.
git clone https://github.com/MaximRouiller/blog.decayingcode.com
What we’re going to do is generate a script to convert them over to two different engine in very different languages.
Impossible? A week-long job? Not even.
Here are our goals.
I’m not especially attached to my template, so I exclude that from the conversion.
Also to take a note, images haven’t been transitioned, but it would be a simple task to do.
First, you’ll need to install Wyam’s latest release.
I went with the zip file and extracted the content to
# I don't want to retype the type so I'm temporarily adding it to my PowerShell Path
First, you’ll need to install Hugo.
Then select a theme. I went with the Minimal theme.
# Create a new hugo site and navigate to the directory
So how long did it take me? Hours? No. In fact, it took me longer to write this blog post relating the events than doing the actual conversion.
Well, you shouldn’t. The blog is an excuse to talk about static content.
Throughout our careers, we often get stuck using comfortable patterns and solutions for the problems we encounter. Sometimes, it’s useful to disconnect ourselves from our hammers to stop seeing nails everywhere.
Now. Let’s forget about blogs and take a look at your current project. Does everything need to be dynamic? I’m not just talking HTML here. I’m also talking JSON, XML, etc.
Do you need to have your data regenerated every time?
What can be transformed from a dynamic pipeline running onto a language full of features and execution path to a simple IO operation?
Let me know in the comment.