2011-05-15 // 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.
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:
- Hello world
- Second try
- Third time is a charm
You can create them like every other wiki page. Just call http://example.com/doku.php?id=hello_world
3) 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.
You can choose if the Wiki page shall belong to a blog by using the “Blog” selection box. Choose default
4) 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
- You may find the following resources useful if you want to customize your blog:
- My mnml-blog template (even if you are not going to use it, it may help you to create your own).
- Use the
~~READMORE~~
makro if you want to prevent displaying the whole content of long postings via<blog list>
. Just insert it where a “Read more…” link shall appear. I note this because the current BlogTNG documentation is relatively spare. - DokuWiki creates a blog RSS feed for you. You can find it at
feed.php?mode=blogtng&blog=<blogname>
(just replace<blogname>
with your blog, e.g.default
). I recommend to use the URL with Feedburner to relieve your webserver from load and to prevent loosing readers if your DokuWiki feed URL changes some day. - You may use the Include plugin to show the content of pages with
<blog *>
syntax commands at other places. - Unlike DokuWiki itself, BlogTNG is using a SQLite database for its metadata and comments. But don't worry, this makes the DokuWiki administration and backup not complicated. SQLite is bundled with PHP 5 and enabled by default. The database itself is just a
blogtng.sqlite
file at DokuWikis meta data directory and therefore you can still backup everything by simply downloading it. - The
blogtng.sqlite
file is currently a SQLite 2 database. Many recent SQLite GUI tools do not support SQLite version below 3.x. If you have to edit the database by hand (for whatever reason), you can use the older SQLite Database Browser 1.1. - Watch out for BlogTNG plugin updates at regular intervals because it is still declared as “in development”. And please open an issue and/or send patches to the developers if you find a bug.

pages
subdir of DokuWiki's data directoryhttp://example.com/doku.php?id=yyyy:mm:dd:hello_world
if you wantdefault
BlogTNG template, more on this laterlimit 2
Optionsortby created
Optionblog default
OptionComments

Really valuable and readable post,I seen awesome post here today.Thank for sharing such valuable and helpful information.

This is a wonderful plugin for DokuWiki!
I also like very much the QR Code displayed on the right sidebar.
Is it generated by another DokuWiki plugin, or is it inserted manually?
Thank you!
@Sam: I'm the developer of a free QR Code API and a QR Code Generator using it. As you can see, I also like QR Codes . Therefore I normally integrate them into my projects (as long it makes any sense): my mnml-blog template is shipped with a small snippet in
/tpl/mnml-blog/user/boxes.php
to show QR Codes in the sidebar, you see it in action her.
However: there is also a barcode plugin for DokuWiki but I never tried it for myself.

@Andreas Haerter: Thank you so much for the information.
The mnml-blog template and your other projects are very good work. Thank you so much for sharing, really appreciated.
First off thanks for taking the time to develop blogTNG, all the Dokuwiki templates, and the documentation around all of them. I'm trying to figure out how you've structured your blog so that it's by year/month/day. Can you explain that bit of your setup in more detail? Also how are you getting the titles (h1 headers) of each blog post to show up using the hspec CSS class?
Thanks, -Sam
@slmingol: Found my issue with the hspec portion of my question. Forgot to do this part of the installation:
Third step:
The files in “lib/tpl/mnml-blog/blogtng-tpl” are a BlogTNG data template
(see <http://www.dokuwiki.org/plugin:blogtng#templates> for details). Please
copy these files into all used BlogTNG data template dirs below
“lib/plugins/blogtng/tpl”.
Hint: By default, there is only “lib/plugins/blogtng/tpl/default”. You may
overwrite the existing files in there (but remember: you have to do this
again on every BlogTNG-Update then!).
Is there a way to do this without overwriting the files in lib/plugins/blogtng/tpl/default/*?
@slmingol:
Is there a way to do this without overwriting the files in lib/plugins/blogtng/tpl/default/*?
You can create an additional BlogTNG template dir like lib/plugins/blogtng/tpl/blog/
or lib/plugins/blogtng/tpl/foobar/
and use this instead of lib/plugins/blogtng/tpl/default
(you may delete lib/plugins/blogtng/tpl/default
when using another dir if you want to prevent listing “default” at the blog selection box – there should be no pages assigned to the “default” blog anymore, for sure).
First off thanks for taking the time to develop blogTNG […]
Thank you. But to be correct here: The templates and stuff are developed by me, but the BlogTNG plugin is maintained by dokufreaks.
@Andreas Haerter: Thanks that did the trick. One of my other questions was how do you structure your blog so that it's year/month/day in the urls?
@slmingol: Well, you can do this by hand (just how you would create any other wiki page: call it and click on “Create this page”). Or create a non-public page with a form (see the docs for details) to make it more comfortable (replace “foobar” with the used Blog):
====== Create new blog post ====== <blog newform> title Add new page to the blog "foobar", format "yyyy:mm:dd:title" blog foobar format %Y:%m:%d:%{title} </blog>
Have a look at the mnmlblog_newpostform_location
template config option if you are using my mnml-blog template. You can set the name of page containing such a form there, it will be the target of the “New Post” link shown on the right side of the footer.

Very useful. Thanks ! We decided to use it on http://www.solidrnet.fr in a few time.
Hi Andreas,
First, thanks for your work on this excellent template. I have a question I hope you can help me with. On my site http://linuxisit.com the formatting section below the comment box does not show up, like it does here. I've looked in /lib/tpl/mnmnl-blog/blogtng-tpl/entry.php and there's a section there for that, so it should display, but it's not. Any ideas?
cheers
Another thing I just thought of, I subscribed to comments here so I would get an alert if/when you answer … how do you manage those subscriptions? I looked around my site and coudln't find anything related to subscriptions.
mark
First thanks for this post, this template and the plugin blogtng.
I switched this weekend to your template on my site : http://blog.slucas.fr.
I also made some modifications that I described in this post (in french) :
- CSS modification to add shadow
- CSS modification to make it easily readable on a mobile phone.
- Integration of the translation dokuwiki plugin
My main modification if about the mobile style, if you're interested in the idea I'll be willing to spend a little time to make it ready to be integrated.
About the integration of the translation I had in mind to modify the dokuwiki page of this template or maybe you have a better idea ?
Thanks again.
Sébastien
how do you put the Recent Comments in the sidebar ? thanks you!
@hollman: blog recentcomments syntax is the key. I created the wiki page “wiki:recent_comments” using the following markup:
<blog recentcomments> blog default tpl default limit 6 type comment nolistwrap 0 </blog>
If you are using the mnml-blog template, edit the /lib/tpl/mnml-blog/user/boxes.php
afterwards. You will find an example there at line 57. Just remove the PHP comment and adapt “wiki:recent_comments” as needed.
@Sébastien: I'm very busy right now. I'll contact you ASAP.
@mark: Have you followed the installation instructions?
The files in “lib/tpl/mnml-blog/blogtng-tpl” are a BlogTNG data template (see BlogTNG templates for details). Please copy these files into all used BlogTNG data template dirs below “lib/plugins/blogtng/tpl”.
Hint: By default, there is only “lib/plugins/blogtng/tpl/default”. You may overwrite the existing files in there (but remember: you have to do this again on every BlogTNG-Update then!).
Regarding subscriptions: There is no BlogTNG GUI for it right now. Still ToDo.
How do you get the h1 tags to show up with a class of “hspec”?? I can't seem to do it?
@Varun Hemachandran: I guess you are using the mnml-blog template. Your problem has nothing to do with BlogTNG (→ if you need more help: Please refer to the discussion page or open a thread in the DokuWiki forum).
However: the mnml-blog template adds the “hspec” class to every h1-headline if it is a blog posting (and only if this is the case). If not, check if you really followed the installation instructions (→ especially “3.”).

Hello!
Thank you for your effort!! This blog helped me A LOT!!
I have just one little problem and i hope someone can help me PLEASE. I set everything up as described in your block and it works great!
BUT i want all blog entry's which are shown at the “front page” in a list to be in short form. Therefore i like to use the “small_list.php” described in the blogtng manuel (http://www.dokuwiki.org/plugin:blogtng). But i can't get it done!!! Can someone tell me what to do?
I tried to put “small_list.php” after the attribute “tpl” between
but it does not work
I tried many other things too…
Hi, i'm trying to install it withouth success. When i open my site an error will shown… i had to remote the pulugin Fatal error: Call to undefined function sqlite_open() in /home/mhd-01/www.planetbud.net/htdocs/lib/plugins/blogtng/helper/sqlite.php on line 44 The sqlite plugin for php is enabled… any ideas?
Leave a comment…
- E-Mail address will not be published.
- Formatting:
//italic// __underlined__
**bold**''preformatted''
- Links:
[[http://example.com]]
[[http://example.com|Link Text]] - Quotation:
> This is a quote. Don't forget the space in front of the text: "> "
- Code:
<code>This is unspecific source code</code>
<code [lang]>This is specifc [lang] code</code>
<code php><?php echo 'example'; ?></code>
Available: html, css, javascript, bash, cpp, … - Lists:
Indent your text by two spaces and use a * for
each unordered list item or a - for ordered ones.
[…] BlogTNG […]