So I switched to Kirby

31st May 2012 | Comments

I've used Jekyll, or to be specific, the framework Octopress for this blog. It's quite simple: You write your article as a text file, then run a compiler who creates various HTML files for articles, archives list etc. and after that you can upload everything. Sounds nice, but I somehow disliked the process of recompiling the whole blog everytime you change something. And Jerkyll is written in Ruby which I'm currently not really aware off.

Then I heard of Kirby which is a smart file-based CMS and currently powers this site. Templates and the engine is written in PHP while blog articles (or pages) are text files again.

What's wrong with WordPress?

There is nothing wrong with WordPress, it's a great software with a lot of opportunities. It comes with a multi-user interface, has a lot of features and is running many big websites. In case the backend or template is missing a feature it could be easily added by installing a plugin. Thanks to the community various plugins are available and the WordPress architecture allows to hook a plugin into nearly every step of the website generation process.

But this is also the handicap of WordPress. It has too many features I don't need and it got quite complex. For me as a single user who knows how to build websites, it isn't needed to provide a media management system, a user administration and a big repository of more or less good plugins. For me a blogging system could be more simple. Just some part that generates the website by using the templates I wrote and one that manages the content. And that is exactly what Kirby provides.

So what are the features?

For me the main feature is its simplicity. Content is saved as files in a folder structure which also represents the structure of the website. Additionally there is a clear separation of content, engine and template. For example just replace the engine folder in case of an update.

Take a look at my folder structure:

Maybe you already thought about it: Thanks to this great file based content management you could easily add content by FTP, SFTP, git, Dropbox synchronization etc. Every text file has parameters like Tile, Date and Text which is formatted with an extended version of the great Markdown syntax.

Additionally templates and everything are written in PHP which runs on nearly every webspace you could find and also code could be easily adapted.

On the downside

The easy, well structured content management could also be a problem because it is limited to what it is intended for. Just an example: I like the way how WordPress blogs usually generate URLs: http://blog.example.com/2012/05/31/test/ But in Kirby folders could not be a number without text and also you would have to create extra folders for years, months and days. Pretty complex and messy.

I think you could hack some mod_rewrite code and modify the template to simulate these type of URLs while still using the current, flat structure. But this was never intended by Kirby and isn't the best solution.

A quite interesting topic are comments. Currently I'm using Disqus as external service to integrate comments into my blog. I think as soon as somebody reads my blog articles he should have an easy way to reply. And normally I would prefer to handle comments myself and save them with my content system, but Kirby itself has no concept for visitor input. Fortunately the developer of Kirby has just released the alpha version of a forum generated with Kirby and a comment system would be quite similar.

Also keep in mind that while Kirby is declared as Open Source, you must purchase a license to use it in production. But you can try for free and you will get really great support. For me, it was worth the money.

Kirby on lighttpd

It's quite easy to get Kirby running on a lighttpd server: Install PHP support and unzip the Kirby files to the document root of your domain. Then create this simple lighttpd configuration to port the .htaccess functionality to lighttpd for supporting pretty urls:

# /etc/lighttpd/conf-available/20-rewrite.conf

server.modules += ( "mod_rewrite" )

$HTTP["host"] == "example.com" {
    url.rewrite-once = (
        "^/content/(.*)\.txt$" => "/index.php",
        "^/(site|kirby)/(.*)$" => "/index.php"
    )

    url.rewrite-if-not-file = (
        "^/panel/(.*)$" => "/panel/index.php",
        "^/(.*)$" => "/index.php"
    )
}

This will block all direct file access of text files as well as files within the only internally used folders. Also all requests are directed to the index.php files of either the panel extension or the Kirby engine itself. If you use Kirby within a subfolder, just add the name to the beginning of each path (e.g. "^/subfolder/(.*)$" => "/subfolder/index.php").

Place the configuration in /etc/lighttpd/conf-available/20-rewrite.conf and activate it with sudo lighty-enable-mod rewrite && sudo service lighttpd reload. That's it.

Voilà

Now you can change settings, adapt the template and write documents like this one:

Title: So I switched to Kirby
-----
Date: 31.05.2012
-----
Text:

I've used [Jerkyll](http://jekyllrb.com/), or to be specific, the framework [...]

Yeah, that just was meta.

blog comments powered by Disqus