I was looking for a small and simple blogging engine to reinstall my old blogging domain www.wgdd.de without having to reinstall Wordpress, which is to my opinion much too large for my small blog. Unfortunately there seem to be only few alternatives, e.g. zine (too old) or jekyll (well, might be an alternative) and several of them haven't seen any updates for years. So I decided to give a try to NanoBlogger, which is also available in Debian. If you don't know this software: it is a static website generator made of common UNIX tools and doesn't require any database nor webserver backends.
After figuring out how to start (there is some nice documentation) I imported all my wordpress articles (manually) and news from another website of mine. Some downsides I discovered: some commands don't work es expected, e.g. nb edit tag X simply says no changes were made! goodbye.
i That's not intuitive. Also figuring out how to change an entries posting date wasn't easy. It basically boils down to the following steps (consider this entry itself):
- create an entry (with or without setting a TIMESTAMP, save it and update the weblog (the latter is done automatically) - these steps will automatically fill the DATE field and name the file accordingly to the output of date -u -d "2012-10-05 21:53:06"
- now either way by adding a TIMESTAMP field editing the file or adding it via commandline: don't touch the DATE field!; just adjust the date in the TIMESTAMP field; after saving the file, nanoblogger will fix the DATE field itself
- next time you are editing the file, the TIMESTAMP field is still present: if you are not going to change it again, you must remove it; otherwise nanoblogger will report this error:
invalid entry TIMESTAMP or conflict
Some more downsides:
Some more downsides:
- It becomes slower with increasing entry count. Especially when making a change to blog.conf, which requires a complete rebuild of the weblog, this might become annoying.
- After changing an entries timestamp, its tag assignments are lost.
- Articles cannot be as easily managed as entries, although it is not claer to me, why. E.g. deletion of an articles is impossible (why not: nb delete article X (just make X and assignment based on any sorting order listing articles)?
- Looks like entry descriptions are not put into the meta-description tag of the resulting file (clear bug?).
- Internationalization doesn't seem to be easy (customizable). It would be nice to have the possibility to create files containing the chosen language. Also it would be nice if the lang attribute would be set accordingly to xml:lang based on a chosen language, e.g. by setting a variable BLOG_LANG. I've already fixed _this_ locally. Another idea would be to have a LANG field in the entry meta file, which content would then be added to the lang and xml:lang attributes of the relevant container element. Maybe I'll try to fix this locally too.
- The tag handling isn't that comfortable. Would be nice to have a field for this too.
However, you see I'm still using this software. So it's not that bad, right :) However I hope, development is going on with this software.
I was also checking, if and how I could integrate this blog into my other website debian.wgdd.de where I used to have a similar news layout in a manually maintained HTML file. The good thing was, that the basic layouts were pretty similar. I was able to achive almost the same layout design by just renaming the div-containers in nanoblogger output (templates/main_index.htm) accordingly to my chosing and adding an import
-statement at the top of the blog CSS stylesheet importing my own stylesheet. This worked pretty nice. However, there were still some duplicate selectors (happily no ID- or CLASS-based duplicates). So IMHO customization would still have been difficult including large changes - e.g. applying customizations to all template files in templates/, making it necessary to synchronize the layout design code in around 10 different files. So I decided against the layout customization and searched for a way, to dynamically load only the blog container without the title bar and the sidebar into a HTML file. My first (PHP-based) solution basicly looks like this:
<?php
$doc = new DOMDocument();
$doc->preserveWhiteSpace = false;
$doc->load('http://invalid.tld/index.html');
$doc->formatOutput = true;
$xpath = new DOMXPath($doc);
$xpath->registerNamespace("html", "http://www.w3.org/1999/xhtml");
$result = $xpath->query('//html:div[@id="content"]')->item(0);
echo $doc->saveXML($result);
?>
I'll play with this a bit more. In an ideal world, I would like to import only entries related to the debian tag. Unfortunately nanoblogger doesn't provide a site containing only such blog entries (only a site containing the titles of such posts). I can imagine a way to do this: it would require another xpath query or an iteraion over $result
. And this is the possible downside: it might increase load time further, which I don't want. However, it's a start.
Stay tuned.
Update
I was able to solve a few issues and I discovered, that I don't need the PHP code above. The blog software provides parts of the website via the /parts/ directory, e.g. parts/index.html (recent blog entries) or parts/category/index.html (category entries).