// 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

  • You may find the following resources useful if you want to customize your blog:
  • 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.
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

Comments

list building course
No. 2 @ 2011/07/26 12:48

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

Sam
No. 3 @ 2011/07/26 14:54

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!

No. 4 @ 2011/07/26 15:08

@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.

Sam
No. 5 @ 2011/07/27 10:59

@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.

No. 6 @ 2011/07/31 10:59

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

No. 7 @ 2011/07/31 11:33

@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/*?

No. 8 @ 2011/07/31 14:57

@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.

No. 9 @ 2011/07/31 15:55

@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?

No. 10 @ 2011/07/31 16:13

@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.

Christophe
No. 11 @ 2011/09/01 10:30

Very useful. Thanks ! We decided to use it on http://www.solidrnet.fr in a few time.

No. 12 @ 2011/09/09 02:08

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

No. 13 @ 2011/09/09 02:21

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

No. 14 @ 2011/09/18 15:15

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

No. 15 @ 2011/10/07 18:01

how do you put the Recent Comments in the sidebar ? thanks you!

No. 16 @ 2011/10/09 20:36

@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.

No. 17 @ 2011/10/09 20:38

@Sébastien: I'm very busy right now. I'll contact you ASAP. :-)

No. 18 @ 2011/10/10 16:47

@Andreas Haerter: Thank you very much!

No. 19 @ 2011/10/10 16:48

@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.

No. 20 @ 2012/02/23 19:21

How do you get the h1 tags to show up with a class of “hspec”?? I can't seem to do it?

No. 21 @ 2012/02/23 20:20

@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.”).

No. 22 @ 2012/02/24 08:00

[…] Blog-Artikel […]

Lisa
No. 23 @ 2012/02/24 15:37

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…

No. 24 @ 2012/05/22 12:29

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?

No. 25 @ 2012/07/26 07:56

Wow. This is great… I'll try this. Thanks.

No. 26 @ 2012/07/26 07:57

@Erial: I have a question…This system doesn't support delete comment? I can't find delete button…

Leave a comment…




E Q D R P
  • 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.
I'm no native speaker (English)
Please let me know if you find any errors (I want to improve my English skills). Thank you!
QR Code: URL of current page
QR Code: URL of current page 2011:05:15:how-to-create-a-dokuwiki-blog-blogtng-plugin (generated for current page)