← Back to index

Writing a blog engine, part 2

June 8, 2016 · 3 min

It has now been three months since I started working on my blog, and a lot has happened during this time. I have come up with new ideas, scrapped old ones, learnt more about Python and struggled with design, to name a few things. I have also developed a new way of working on personal projects. Even though I consider my website and blog to be far from finished (to be honest it will probably never be completely finished), I would at least like to say that the first incarnation of it is now complete.

What I have built so far

A live view of the project can be seen at my website mats.hgbrg.se. At the time of writing it has a fully working blog, where posts are parsed from plain Markdown files, and a simple landing page where I have written a few sentences about myself.

The bulk of the work is done by a Python script and a Makefile. The Python script parses all Markdown files in the posts folder, and outputs them as HTML in the output folder. All static non-Markdown files, like CSS, JavaScript, images, etc. are copied by the Makefile. For templating I chose to go with Mustache, but I can't say that I am completely content with the its logic-less nature. I would rather use something like Handlebars that allows for more advanced templates. The site is hosted at GitHub Pages, and deployed with a simple make deploy that fetches the latest posts, generates the site, and pushes the static content to the dedicated GitHub Pages repository.

If you want to see the code, you can find it here.

What lays ahead?

My main goal for the future is to create a better looking landing page that will act sort of like a digital resume. I have searched the Internet for inspiration from personal websites for other developers, and two that I have found that I really like are jessfraz.com and johanbrook.com, the latter from which I have taken a lot of inspiration from when building my site.

I also want to create a webpage for my current activities and goals. Thomas Frank from College Info Geek, who I really admire (you should listen to his podcast, it is great), recommends this web service called Beeminder to keep track of your goals and to keep you motivated. I saw that they have an API, and maybe I can do something fun with it.

I also want to develop the technical part of both the website and the build script. For example I want to migrate from plain old CSS to Sass and set up a service like Travis CI that automatically builds the website when I publish a new post or implement a new feature. I also want to implement comment functionality, but that would require a server with an API and some extra tinkering.

Scrapping the generic part

When I first started working on my blog, I had this vision of a completely generic blog engine, powered by git, that could be used by anyone anywhere to generate their static blog. Every design decision and feature implemented was made with this in consideration. I have to be able to specify the input and output folders for blog posts. Everyone won't have these at the same place! What if someone wants to have tags with spaces? That has to work! Even for the code itself: This function should be made generic so that it could be used anywhere. In every step I took all obscure edge cases in consideration, and reasoned as though I already had tons of users utilizing my simple tool to generate their sites. I know, this sounds idiotic, and it soon turned out to hold me back, hard.

Eventually I came to this revelation - when building something for yourself, don't waste time considering edge cases and implementing features that you don't really need. Realizing this was a huge relief for me. I could now focus on developing functionality that I actually needed, and I could do it without taking other people and their use cases into consideration. I went from having a mindset of developing a generic tool, to just developing my personal website. I actually renamed the repository from blog-engine to personal-website. My work could now continue unhindered, and I developed new features with blazing speed!

Using GitHub issues to stay motivated

As I mentioned in the beginning, I have developed a new way of working on personal projects. What this is is essentially me just making issues on GitHub for every idea, bug, feature, enhancement, etc. that I come to think of. Doing this has really helped me when working on this project, as it has lowered the threshold of getting to work by a significant amount. Getting to work now is as easy as picking an issue, marking it as "In progress" and starting to code.


In parallel to working on my website I have also developed a script that makes it easy to block distracting websites. Check it out here.

Over and out.

/Mats