How to create a DokuWiki based blog (BlogTNG plugin)

Using DokuWiki is fun. It gives you all you need to manage different types of content like common text, quotes, files, data tables and source code. It displays your content in a proper way, including typography replacements and many other features (see Syntax for some examples). It is especially perfect to write about IT where console output or code snippets matter. You can even include RSS feeds and create galleries with a single line of text. Additionally, DokuWiki is very easy to administrate and maintain (this is my personal killer feature). Installing updates is damn simple (in principle, you just have to copy the new files over the old ones). And you can do backups by downloading everything from your webserver. No database dumps and stuff needed. Because plain text files are used as storage, you can even access the raw data offline with a simple text editor.1) So why not using DokuWiki as easy maintainable blog? Exactly!

There are two common ways to create a DokuWiki based weblog. The traditional one, using the Blog plugin in combination with a bunch of others.2) And the new BlogTNG plugin which is meant as successor of the Blog plugin and already contains components like comments and tags. The following text is about creating a cool WikiBlog with BlogTNG. 8-)

BlogTNG is really good enough for every day usage. But it is not officially declared as “stable” and still has some issues. Therefore you should not use it in important productive environments, especially as complete DokuWiki newbie. Be prepared to find bugs you possibly have to report to get them fixed. You have been warned. ;-)

Preparations

You need an up to date DokuWiki with BlogTNG plugin (surprise). If you stuck on an older DokuWiki version, upgrade to the latest stable release or use a fresh installation. Optional but recommended plugins are Captcha (BlogTNG automatically detects and protects the comments with it), Video Share and Gallery.

Because DokuWiki's installation procedure is pretty straightforward (upload, fill out one form, done) and each plugin can be installed with an URL and single click at the plugin manager, I recommend to try everything out on a separate test installation before using it in a productive environment.

First steps with BlogTNG

BlogTNG is organising all blog postings in “blog” data groups. Expressed in simplified terms, these blogs are just categories to control which of your DokuWiki pages are postings of a blog and which are just normal wiki pages. After one or more wiki pages are assigned to a blog, you can get the typical blog post listing wherever you want by using a special <blog list> syntax. It tells DokuWiki “please show the newest x pages which are belonging to the blog foobar here”. This sounds complicated but it is easier than you might think.

I'll give you an example you may follow on your own installation. Imagine a fully working DokuWiki with BlogTNG plugin at http://example.com/. We are going to create three new blog postings now:

  1. Hello world
  2. Second try
  3. Third time is a charm

You can create them like every other wiki page. Just call http://example.com/doku.php?id=hello_world3) and click on the “Create this page” button to open the page creation menu for the first post. Fill it with content and then have a look at the additional control elements below the textarea before you save the page.

Additional BlogTNG control elements

You can choose if the Wiki page shall belong to a blog by using the “Blog” selection box. Choose default4) and store the page. Do the same with http://example.com/doku.php?id=second_try and http://example.com/doku.php?id=third_time_is_a_charm.

Now you have three blog postings for the default blog. But how to get them listed on the http://example.com/ homepage? This is where the <blog list> and <blog pagination> syntax comes into play. Edit the start page and insert the following:

<blog list>
  blog   default
  tpl    default
  limit  2
  sortby created
  cache  0
</blog>

<blog pagination>
  blog   default
  limit  2
</blog>

The <blog list> options are telling DokuWiki to list the two5) newest6) wiki pages which are assigned to the default blog.7) <blog pagination> inserts a default blog page navigation if there are more postings for the blog than defined by the limit option (therefore you should use the same limit values for both <blog list> and <blog pagination>). Has the penny dropped? I hope so :-). Just experiment by adding more postings to your blog (or remove them by adjusting the “Blog” selection box to the empty value).

Now a few words about the so called BlogTNG templates. The name might be a little bit confusing because these BlogTNG templates have nothing to do with common DokuWiki templates. A BlogTNG template is a set of files in /lib/plugins/blogtng/tpl/<template-name>/. These files provide some markup for the different BlogTNG functions (just like DokuWiki templates provide the markup frame for the general wiki layout). But a new /lib/plugins/blogtng/tpl/<template-name>/entry.php file also triggers the creation of a new <template-name> blog. I'll give you an example: If you copy the existing /lib/plugins/blogtng/tpl/default/ directory to /lib/plugins/blogtng/tpl/foobar/ you can choose between the blogs default and foobar at the blog selection box when creating or editing a wiki page. By using this feature, you can even create multiple blogs on the same DokuWiki installation. For example, just use <blog list|pagination> to list all default postings on http://example.com/default and all foobar postings on http://example.com/foobar. All you have to do is to control which postings are shown on the pages by adjusting the blog and tpl options.

Please note that there are also other <blog *> syntax commands (to create tag clouds, a recent comments listing etc.). So read the plugin documentation to learn more about.

Additional notes

1)
which is perfect e.g. if you screwed your webserver and documented its configuration in the wiki running on it. ;-) Just open the last backup and access the text files you need in the pages subdir of DokuWiki's data directory
3)
or use another URL scheme like http://example.com/doku.php?id=yyyy:mm:dd:hello_world if you want
4)
BlogTNG comes with a default BlogTNG template, more on this later
5)
limit 2 Option
6)
sortby created Option
7)
blog default Option