Writing a Simple CMS for my blog

Using nikola as a static site generator and generating my blog from it has some benefits but one big drawback. It is not really user friendly for non-tech users. Since I wanted to enable non-tech users to write blog posts, I had to come up with a solution. After some research I wasn't happy with all the solutions available on the market. Either they had requirements like a database or they had only CLI interfaces. I wanted something that uses git as a storage system and has no additional user management or whatsoever. It should be possible to create new blog entries, edit existing ones, and add images and generate my blog when commited with nikola.

Automatically deploying your blog with post-receive hooks

When deploying your Nikola blog with a post-receive hook keep in mind that you can't just use

git pull

Executing this command will result in the following error message.

remote fatal not a git repository '.'

This behavior is caused by the fact, that git does not use the PWD environment variable but GIT_DIR. Changing the directory does not change GIT_DIR, and therefore a git pull will fail. To get the behavior, you want to set the GIT_DIR environment variable like the following example shows.

cd /your/repo
GIT_DIR=.git git pull

Now you can continue to build your blog using Nikola.

Switching from blogofile to Nikola

A while ago I decided to write down my recipes an put them on a blog. The first question to answer was: Which platform should I use? I didn't like the idea of hosting my blog on someone else's server neither the idea of hosting some crapy php stuff (or any other stuff that is executed on my server). So I stumbled upon blogofile , a static site generator. After a few hours of setup and getting used to markdown my blog was online, ugly but up and running. Configured with git post-commit hooks and all that fancy stuff. Since then some time passed by and it seems that blogofile is no longer actively maintained and I decided to look out for a new platform to run my blog.

Read more…