One of the most useful things I self host on my server is a personal wiki. I use it for note taking on projects, a journal, a beer homebrew log, storing recipes, config files, and for archiving web pages or documents. It is a great alternative to Evernote or OneNote if you want to keep your information out of the corporate cloud.

There are many wikis out there but I prefer the low-overhead DokuWiki, which is easy to install and uses flat plaintext files to store your wiki pages so it’s easy to set up anywhere and backup your data. DokuWiki as a default install is very basic and can be extended to do almost anything with a few plugins. Read below for some of my recommendations for making the most of your wiki and some example use cases.

SETTING UP DOKUWIKI

The first thing you will want to do is download DokuWiki. I usually go ahead and add all the suggested plugins on this page – especially the wrap one is quite useful.

Installing is as simple as unzipping your tarball on your server and running through the initial configuration. After that, you are good to go.

For a personal wiki, we obviously don’t want the whole world to be able to read it and we don’t want new sign-ups. So let’s edit the Access Control List to disable public acess like so:

Adding a wildcard “None” permissions to @ALL will disable all permissions for non-registered users.

In the Configuration Settings make sure registering is disabled:

Congrats, you now have a private wiki that only you can edit and view.

EXTENDING DOKUWIKI WITH PLUGINS

DokuWiki itself offers pretty basic wiki functionality. There are quite a few plugins for extending what you can do, but the DokuWiki plugin page is kind of a mess with many outdated or duplicate plugins. After spending a lot of time searching through it, here is what I use and recommend:

Blockquote – Easily add blockquoted text

Blog – displays your posts in a familiar blog format

Todo – add todo’s to wiki pages and assign to users if desired

Dokubookmark – archive web pages with a simple bookmarklet to your wiki

DW2PDF – Export wiki pages as PDFs

EditTable – Visually edit and add tables

Gallery – Embed image galleries in pages

Move – move pages and namespaces while preserving all links

Note – Insert notes that stand out from the rest of your text. Useful for documentation.

NSPages – Automatically generate a custom list of pages in your wiki or namespace

TemplatePageName – Changes the default template names so they can be edited from within the wiki.

RSS – include an RSS feed in your wiki page

Struct – Index, display, and query structured data in your wiki pages (requires SQLite)

Tag – add tagging functions

VShare – Embed videos

Wrap – probably the most useful formatting plugin – easily add columns, notes, divs, etc.

Yearbox – Auto generate a table with links for a journal or diary, very customizable.

There are many more, some quite specialized, so whatever your use case you should be able to find an extension for it with a little digging. If you have any favorites I missed, leave a comment below!

NAMESPACES & TEMPLATES

One of the more useful features of DokuWiki is the ability to group pages in namespaces, which in the flat file structure is simply a directory. Organizing your wiki pages into namespaces allows you to do useful things like create lists of pages (using NSPages) or automatically apply templates.

Creating a namespace is as simple as adding a colon to your page name (ie: namespace:page_name).

There are several ways to handle templates, so I suggest referring to the documentation for an overview. By default, any page named _template.txt will apply to all pages within the current namespace and any page named __template.txt (an “inherited” template) will apply to that namespace and all below it. The problem is that these files are not directly editable in DokuWiki because you can’t add files that start with an underscore – you would need to do it manually over SSH or FTP – which is very annoying.

A solution to this is to use the TemplatePageName to change where DokuWiki looks for templates, by default c_template (current namespace) and i_template (inherited). These pages can then be created and edited from within DokuWiki.

USE CASES

RECIPES

I am an avid homebrewer, and a big part of perfecting your beers is keeping detailed records about the process. I’ve created a template in the wiki format, and I want every new recipe I create in my recipes:homebrewing namespace to use it automatically. I’d also like to tag my recipes by brewing style using the tag plugin.

The first step here is to create a recipes:homebrewing:c_template file from within DokuWiki. In addition to the standard markdown, you can add in variables to auto-generate some info into your template – a reference for these is in the documentation.

Here is my brewing template. Now if I create a recipes:homebrewing:test_template_beer file it is auto populated with my template:



Awesome. I can now also index my recipes:homebrewing namespace using NSPages to create a nice alphabetical list.

<nspages recipes:homebrewing -textPages="Homebrew Recipes" -h1 -exclude:c_template>



(tip: add ~~NOCACHE~~ to pages that are dynamically generated by plugins)

JOURNAL

I like to use my wiki to keep track of my days and jot down any thoughts or keep track of lists. These are the kinds of notes I’d like to archive for myself, and not have tied up in someone else’s software or cloud. I also tend to sketch and diagram a lot on paper, and I like how easy it is for me to upload a photo from my phone to archive it.

The yearbox plugin is my favorite for this use. It provides an easy way to generate a bunch of links in a nicely organized namespace, and is pretty customizable. Here’s a few examples from the documentation showing various options:

Since I’m starting a new year here, mine is showing the next 3 months out, and putting all those pages in the journal namespace:

{{yearbox>year=2018;months=1,2,3;ns=journal;name=day;size=10}}

I’m using a different DokuWiki theme so mine is a little simpler than the default:

If you click the links you’ll see the pages are organized by month in the journal namespace, ie: journal:2018-01:day-2018-01-01

I’d like to auto populate the date as a heading, and show a list of recent entries at the bottom. Because my entries are in sub-namespaces under journal this is a case where I’d use an inherited template – journal:i_template.

====== %A, %B %e ====== ---- {{yearbox>year=%Y;months=%m;ns=journal;name=day;size=10}} ~~NOCACHE~~

As you can see, we can use strftime placeholders for the date. This template will generate a headline and show the current month as a yearbox at the bottom.

FURTHER RESOURCES

Here are some reference links to help you get you started with your wiki.