Haran Kumar

A blogging platform in 60 lines of JavaScript

Because... why not?

April 16, 2018

In the words of Mick Jagger: "Anything worth doing is worth overdoing."

These are words I try to live by. And so, when I decided to write a blog, I knew that Medium or WordPress wouldn't suffice. Even though any of the numerous available blogging platforms would've done the trick, none of them quite "felt" right. I didn't want bloat, front-end JavaScript, or ads wasting the time and bandwidth of my readers. That's my job.

So naturally, I re-invented the wheel.

You're actually reading this blog post on Bloggeroni, my homemade, minimalist blogging platform. Well, "platform," because it's a lot closer to a script with a config file. Categorizing Bloggeroni as a platform is basically the same as categorizing eyebrows as facial hair.

Despite not being revolutionary, Bloggeroni has more going for it than just a delicious name. Hand it a JSON file with a list of posts, the blog's metadata, and paths to markdown files, and it'll generate a static site with a homepage and individual posts. It can even handle tags. Can you believe it?

Under the hood, Bloggeroni is a tiny Node script. It uses Handlebars to fill templates for the homepage and post with data from the JSON configuration file. It uses marky-markdown to compile the markdown blog posts into HTML. I put together some really simple CSS to make the pages look decent. The output is JavaScript-free and ready for use with Github Pages or your preferred static hosting provider.

If you're curious, feel free to check out the source code. It does exactly what you think it does.

Bloggeroni doesn't have all the bells and whistles of other platforms. There are no analytics, no RSS feeds, and all the metadata is inputted by hand. But for the scale at which I'm currently operating, these aren't significant drawbacks. I may be pretentious, but I'm not delusional.

On that note, I don't expect anyone else to use this. If you're going to go to the trouble of using a custom blogging system, why not spend an hour or two building it yourself? I know first hand that the type of person who would use something like this is the type of person who would rather build it from scratch. But I hope that this might be an inspiration for you to build something cool of your own.

Aside from minimalism, the biggest selling point of building my own blogging system is that it's mine. I know what every line of code does and can tweak every detail as I see fit — something I'll never get from an off the shelf platform.

While there are tons of shiny new flying cars on the market, crafting a unicycle out of duct tape is more fun, and in this case, gets you precisely what you want and nothing more. Sometimes, reinventing the wheel is worth it.

Bon Voyage!