Table of Contents
Blogging with DokuWiki
There are basically two ways to use DokuWiki for blogging.
- Combine a couple plugins to extend DokuWiki with the right features so it is a complete blog. Please see the directions below.
- Or install the BlogTNG plugin.
The features completeness of both approaches differ.
The main difference between the two plugins is that BlogTNG is an all-in-one solution that uses a sqlite database for storing the blogging information. Arbitrary pages can be marked as belonging to a certain blog, there is no need to use any specific namespace structure. However this also means that you can't use the discussion or tagging features for non-blog pages which is possible with the modular setup.
The modular setup contains some more features like comment moderation directly on the blog pages or archive pages while blogtng for example limits plugin syntax usage in comments which is in a typical blog setup definitely a useful feature (but that depends of course also on the installed plugins).
This page is a WORK IN PROGRESS! If you feel you can add to it please improve it wherever you see fit!
Setup blog by combining couple of plugins
This page describes the steps necessary to get you started with blogging in DokuWiki. It also provides useful tips and hints about possible caveats.
If you want to discover existing DokuWiki-based blogs, try this Google search.
In this scenario we have only one single user who wants to use the blog plugin to create manage one blog. The configuration of the blog plugin lets you specify a namespace where all the blog entries will be stored. By default this is set to
:blog which should be OK for most users.
To create the blog you have to decide which wiki page you'd like to use for the blog first and create it. If you want the blog to be the start page of the wiki this would be
:start. After that you just have to add the blog plugin syntax to the page and save it.
The above will display the five latest entries in our blog. Since this is a single-user setup there's no need to specify a namespace in the plugin syntax, instead the default setting will be used. You should see a form now to add new blog entries. But before you add your first entry there's one configuration option left which needs to be set, namely the
dateprefix setting in dokuwiki/lib/plugins/blog/conf/default.php. It can be used to add the date the page was created to the page name of the new page. A good setting here is
%Y:%m%d_. What happens here is that when you enter “my new blog” into the new entry form and press enter, the following page will created
blog:2008:0512_my_new_blog. You see this comes in quite handy to keep your blog namespace organized.
In order to only allow read access to your blog to prevent people from editing your entries it also makes sense to add some ACL rules (the example assumes that you use the
:start page for the blog listing).
start @ALL 1 start yourusername 16 blog:* @ALL 1 blog:* yourusername 16
In this scenario we want to allow different users to have their own blog. For that, each user needs his own blogging namespace and blog listing page where only he is allowed to create and edit pages. For this example we have three users named joey, walter and susi. Each user gets his own namespace below the
:blog namespace and his own listing page. Therefore we have to setup the following ACL rules (example for the user joey):
blog:joey @ALL 1 blog:joey:* @ALL 1 blog:joey joey 16 blog:joey:* joey 16
Note that you can use user wildcards if you want to allow each and every user to blog.
Now you have to create the page
:blog:joey and insert the following blog plugin syntax to setup the blog.
Repeat that for all remaining users. After that they can start blogging by creating new entries with the new entry form.
One of the most important things in a blog is its RSS feed. DokuWiki automatically creates all kind of feeds for you. But for a blog you may want to setup a specially tuned one.
Note: Since the new DokuWiki supports full HTML feeds it's no longer recommended to use the feed plugin to create the blog feed (it's still useful for discussion feeds and the like though).
Determine your feed URL
You will need some parameters to build your blog article feed. Most important is the
ns parameter to limit the feed to your blog articles only. Remember not to use the blog frontpage for the feed because it will result in all your blog entries being included in one single feed item!
Here is a most basic example URL:
You should also make sure it links to the most current version of your article. You can either set the default options to do so or pass it along to
You will most probably also enable DokuWiki's full html feed:
Nice feed URLs with .htaccess
If you have URL rewriting via
.htaccess enabled you should also consider to add some custom rewrite rules to have nice feed URLs. The rewrite rule for the above example would look like this (just add it below the rule for the
RewriteRule ^_feed/?(.*) feed.php?ns=$1&num=10&linkto=current&content=html [QSA,L]
Now you can access you blog feed with
Browsers can discover RSS feeds by certain HTML metadata. By default DokuWiki will provide this metadata for its standard feeds on its own. For a blogging page you might want to disable those feeds and only output your blog feed. This is done by editing your template's
main.php. Here is an example head section:
<head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title><?php tpl_pagetitle()?> [<?php echo strip_tags($conf['title'])?>]</title> <?php tpl_metaheaders(false)?> <link rel="alternate" type="application/rss+xml" title="Blog" href="/feed.php?ns=blog&linkto=page" /> </head>
Notice the parameter
false being passed to the tpl_metaheaders function. This will suppress all default RSS autodiscovery tags.
There are two different ways of dealing with unfinished blog entries in DokuWiki. You could for example setup a dedicated draft namespace where you store them, and at the time you finish them just create the blog entry and copy/paste the article. However, the blog plugin also supports drafts. To mark a blog entry as draft simply put
~~DRAFT~~ into the entry and save it. It will not show up in the blog listing unless you remove
~~DRAFT~~ from the page again. If you want to use this feature it's recommended to also install the feedmod plugin as it also removes drafts from the blog feed. Note: Pages marked as draft with blog plugin still show up in search results!
The discussion plugin provides an administration interface available in DokuWiki's admin menu which allows you to close/open discussions and show/hide/delete comments.
The linkback plugin also provides an administration interface which allows you to delete linkbacks or enable/disable them for single pages.
Displaying only the first section on the front page
Sometimes you don't want to show a full article on the front page because it is too long. To cut it off at a given line, just insert an empty H1 header. To make that work you also have to activate the
firstseconly configuration option of the include plugin.
This is going to be a long post ====== ====== Here comes all the long post
Tuning the feed
DokuWiki's default feed is not 100% suitable for blogging, like it will display the page name as title of the feed item instead of the first headline. To change that you can use the feedmod plugin. It will set the first headline of the blog entry as feed item title and also adds a footer which links to the discussion section, and displays the tags of the post. Furthermore you can add links to social bookmarking services by editing a footer template (for more information please refer to the feedmod plugin page).
Another simple way to add additional features to your feed is to use the Feedburner service. Register at their site, point them to your feed (See Determine your feed URL) and put the Feedburner feed into the autodiscovery tag. This will also move some server load from your site to the Feedburner services.
Dealing with SPAM
Comment SPAM is quite a problem these days. Luckily DokuWiki provides a number of anti spam plugins. Support for the captcha plugin is integrated into the discussion plugin. All you have to do is install it and set it up to your likings.
Treat your filesystem carefully
Fixing wrong timestamps
Some timestamp issues I came across:
- An alternative approach using alphabetic ordering of pages by name could also solve issues if the items have pagenames like
:blog:YYYY-MM:DD-pagetitleor similar. Then the feed.php is consistent with the permalinks of the blog, which would be nice.
— Louwrens van Dellen 2010/05/03 23:23
Change order of "linkback" and "discussion" in rendered wiki page
Is it possible (without changing source/templates) to change the order of the discussion and the linkback plugin? If there is no way without editing, could anybody who is more often editing the code than me, give a hint into the right direction? (I am “speaking” HTML/CSS/PHP)
Unfortunately this is not possible in DokuWiki because of the way the output is generated in the two plugins there is no way to influence the order of the plugins. — Michael Hamann 2013/11/18 13:09
Link to dokuwiki user name instead of real name
In order to limit some problems with namesake, is it possible to change the link user:xxxxx ? The best could be an option in the admin panel to choose between real name or dokuwiki user. Thanks. — To_O
What can I make non-blog pages (e.g. contact – these shouldn't appear in the blog listing)? Is using the ~~DRAFT~~ option a good idea? — Alex