Self Hosting: Setting up a Personal Wiki with DokuWiki

Self Hosted

Written by:

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:

Dokuwiki ACL Settings

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

In the Configuration Settings make sure registering is disabled:

DokuWiki Disable User Registration

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.

RELATED >>  Hardware: Odroid XU4 as Plex Media Server

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:

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

NSPages example
(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:

Yearbox Examples

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:

My Yearbox

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.

Example Journal Entry

FURTHER RESOURCES

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

7 Replies to “Self Hosting: Setting up a Personal Wiki with DokuWiki”

  1. Tristan says:

    Great post, I really enjoyed reading your setup with DokuWiki.

    I had one setup some years ago on my Raspberry but somehow I never made it past the initial start and it soon started collecting dust (this was before my VPN times). Now I use TiddlyWiki for over 4 years already – man time flies… – and I have to say I love it. Up until recently the single file workflow was my goto but since I use my VPN excessively I switched to running it on my Pi again and it works like a charm.

    You might want to check it out sometime if you feel like you need a simple wiki just for yourself without ACL and self contained within one HTML file.

    • brad says:

      TiddlyWiki is great! I used to use it several years ago on a portable USB stick. Does it support templating like DokuWiki? The big plus for me with DW is the amount of plugins available, I know TiddlyWiki does as well but not nearly as extensive.

      I also like that because of the flat, plaintext structure I can script things into the wiki since all it has to do is write a text file in the appropriate place. I use an RSS reader to follow some food blogs, so I am working on a workflow where I can ‘star’ an article in my RSS client and have it automatically imported into the wiki in markdown. If I get it working I’ll make another post.

      • Tristan says:

        Well my last DokuWiki setup was a long time ago so I do not know how it works there. But as far as TiddlyWiki is concerned it supports templating very well. As Tiddlers are treated like database records it just pipes them through the template which is very nice for many similar “records”. Just pop a common tag or some other field in them and they all get rendered via the template.

        Yes there are by far less plugins than for DokuWiki as the community is way smaller. But I found the Google Group – even though I am not a big fan of that – very helpful. Whenever there is a question popping up one gets an answer within a day and a lot of inspirational input.

  2. Matt says:

    Out of curiosity, what theme template are you using?

  3. Jeff says:

    Thanks for sharing this. I never even knew personal wikis were a thing! For the past 8 years, I’ve been using Evernote and have amassed over 1,200 notes. The two features I love about Evernote are its web clipper (or even simply copy-pasting from websites and retaining the formatting—CSS included) and the WYSIWYG editor.

    After a brief perusal of DokuWiki’s website, it seems that it isn’t for the faint of heart—at least for the getting started phase.

    In your opinion, is there a chance I might enjoy using DokuWiki? I imagine that converting all those notes I currently have in Evernote would likely be a chore, so I’m mainly concerned with forward-facing usage.

    • brad says:

      I used to use Evernote as well, although I wasn’t nearly as invested as you! I actually started using personal wikis after Evernote was hacked in 2013-ish. Made me think twice about storing personal info in cloud services.

      A simpler solution for a wiki would be https://tiddlywiki.com/ which you might be interested in.

      There is a bookmarklet for Dokuwiki, it just copies the plaintext you select though. DokuWiki isn’t really WYSIWYG, there is a toolbar with buttons for the ultra-simple markdown it uses that makes doing things quick and easy.

      I think what Dokuwiki is good at is storing lots of info that’s very similar, or for quickly linking free form notes (to make a link or new page just [[type double brackets]]). Or take a look at the bureaucracy and struct plugins, which allow you to auto-generate wiki pages with forms and datasets. It seems very powerful but I can’t find a lot of examples of what other people have done with them. Part of the problem is that the DokuWiki plugin documentation is a mess.

      I have another DokuWiki site for recipes I’m almost done tinkering with. There were a couple of options for storing recipes but I chose DokuWiki for a couple of reasons. The flat .txt file storage of pages meant it was very simple to make a script to convert recipes from my previous recipe app into the wiki. This also let me link my private, personal wiki I talk about here with my public recipe sharing one by just using a symbolic link to the recipe folder.

      Using a couple of plugins the whole site generates itself. Namespaces separates recipes into categories, bureaucracy for quickly creating a new recipe by copying and pasting a website into a form, tags and rater for metadata, cloud for generating tag clouds of ingredients and descriptors, nspages for creating lists of pages. It took some setup but it’s running itself pretty well.

Leave a Reply

Your email address will not be published. Required fields are marked *