Building the Blog

Building the Blog

My first blog post on the new engine is going to be about how I built this new engine. The existing blogging solutions are very elaborate platforms, but require some fee which seemed to me a bit too high for the application that I envisioned.

I previously had a website on github pages built with Octopress It’s a blogging framework developed using Jekyll. It’s a great tool if you want to put something together quickly, but it serves only static content. I wanted to have something that would collect statistics about usage and allow visitors to leave comments simple comments.

I decided to start by porting my existing blog to a new platform. I’ve already been pretty well familiar with Heroku service and decided to try Golang as the language for the dynamic part of the app.

The most challenging part for me was to get an html template - I’m not a web designer and didn’t want to spend time to learn this topic end to end in order to come up with something decent. Thankfully, these days plenty of simple templates are available on the Internet free of charge.

I came across a web template designed for ghost platform. It was Attila by zutrinken - a very elegant and simple template. It was designed using handlebars - a templating language for Javascript. The templating language the author used was a custom flavor used on Ghost blogging platform. Fortunately for me, the meaning of the custom commands could be deduced from a blog engine - Journey. This engine supports ghost templates and implements all of the commands used in the template.

Anyways, I decided that it would be easier to use Golang templates instead of trying to replicate the behavior of handlebars engine. Golang templates are configured solely by the configuration object without maintaining any context. In one word, Golang templates are simpler.

The result of my initial efforts of porting the original template can be found here.

There was one tricky part that required some customization - code highlighting. Thankfully it was relatively simple with highlightjs.

The posts are checked into the source repo of the project and rendered using gomarkdown.

That’s about it. Putting all of these pieces together allowed to me to get a simple static web app within days. My favourite part is that I can publish blog posts, by just checking markdown into the repository.

Show Comments