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 >>  Plex & Locast: Recording Local TV Without the Antenna

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.

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

  4. Smika says:

    Thanks for this tuturial, i helpes me a lot. Still I have one problem. When I create a recipe, I used the correct template, but is doesn’t have any format. It still looks like the raw format I paste in the file. Must I have another extension to have the right format?

    • brad says:

      I use the bureaucracy plugin to create a form to copy and paste into. I then have a script that formats it into Markdown nicely before inserting it into the page. Take a look at the bureaucracy plugin.

  5. mark says:

    Hi Brad.
    Thanks for sharing your DokuWiki info here !!

    I have a sort of sideways query as a former user of Zim Wiki – here is the back story:
    With Zim, all one need do to add stuff is to copy TXT files into the desired folders & it is great for totally local uses as long as one doesn’t need their info online – which I do because of working far away from home.
    I used to carry my Zim on a USB stick, but between forgetting to update that & leaving home without it, that effort was a wash.

    Given that I have great hosting, I’ve always wanted to do something similar as a 1-person note keeping effort & tried DokuWiki before, but its messed up extension library drove me nuts !!

    Hence my query is=>
    Do you know of a way that I can use existing plain TXT files along with (whatever) to sort of make a Zim clone with DokuWiki ??

    Thanks for any pointers !!

  6. Christopher J Poor says:

    You could use git with zim. There is a plugin for that and just search the web for “basic git commands”

Leave a Reply

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