/Reed( Kraft-)?Murphy(\.net)?/

the ramblings of a devops engineer and polymath

Setting up a Personal Wiki in Drupal - a "tutorial"

I’ve been looking for a good wiki engine to use for my own personal wiki for a while now - I’ve tried TikiWiki, MediaWiki, DokuWiki, TiddlyWiki and more. I have used, and continue to use, WorkFlowy to keep track of notes, daily logs and random ideas; while I find it great for short, one-line notes, I’ve never felt comfortable using it for longer writing.

Rather than try another wiki solution, I decided I’d use it as an excuse to get further to grips with the incredible flexibility provided by Drupal and the Drupal community and roll my own Drupal wiki. Check out below the cut for more information on how I did it.

Taking WardsWiki’s Wiki principles as a starting guide, I whittled down the requirements for my own single user personal wiki to:

  • Automatic link generation
  • Easy text input
  • Search
  • Diff
  • Page list
  • Page history
  • Access limited to just myself

The Drupal modules that I settled on to implement these features:

Please note that I’ll be assuming you’re already familiar with things like installing and configuring modules, adding content types and managing permissions in Drupal; I also won’t be covering setting up Pathauto or Markdown as I already had them installed at this point. If you need more information, the Drupal Community Documentation is a great place to start, or ask on #drupal or #drupal-support on Freenode.

First things first, install and enable the additional modules using drush:

/var/www/drupal $ drush dl content_access diff freelinking wikitools
Project content_access (7.x-1.2-beta1) downloaded to                         [success]
Project content_access contains 2 modules: content_access_rules, content_access.
Project wikitools (7.x-1.0-alpha1) downloaded to                             [success]
Project freelinking (7.x-3.1) downloaded to                                  [success]
Project freelinking contains 2 modules: freelinking_prepopulate, freelinking.
Project diff (7.x-2.0) downloaded to                                         [success]

/var/www/drupal $ drush -l reedmurphy.net en content_access diff freelinking wikitools
The following extensions will be enabled: wikitools, freelinking, diff, content_access
Do you really want to continue? (y/n): y
content_access was enabled successfully.                                          [ok]
diff was enabled successfully.                                                    [ok]
freelinking was enabled successfully.                                             [ok]
wikitools was enabled successfully.                                               [ok]

Once the modules are enabled, create a new content type for the wiki’s content. Name it “Wiki Page”, set the machine name to simply wiki, and change the title field label to “Page Name”. In the Publishing Options section, uncheck “Promoted to front page”, and check “Create a new revision”. In the Comment settings section, change the default comment setting to “Hidden” (as this is a single user wiki, I don’t need to separate my discussion from my content). In the Diff section, check “Show View changes button on node edit form” and “Enable the Revisions page for this content type”. In the Menu settings section, make sure none of the menus are selected.

Next, In the “Access control” tab, uncheck the view, edit & delete permissions for all roles excluding administrator.

Navigate to the configuration for the Freelinking module. Change “Match Syntax Mode” to your preferred format — I use Markdown as I’m using Markdown for my Drupal input filter — and set “Restrict freelinks to this content type” to “Wiki Page”.

In the Pathauto pattern configuration, set the pattern for Wiki Pages to wiki/[node:title].

Open the WikiTools configuration, and fill it in as follows:

  • Wiki path: /wiki
  • Title of main page: Main Page
  • Wiki node types: only check Wiki Page
  • Options: Node Creation, Node Search, Automatic Redirect, Unique Titles, Treat underscores as spaces
  • Wiki 404 type: Link to creation
  • Enable Hiijack freelinking filter

In Drupal’s core permissions settings, ensure that your nominated role has all the permissions for the new Wiki Page content type, and that other roles have none.

Finally, navigate to http://$your_drupal_domain/wiki, click the link to create your new wiki landing page, et voilà! You now have a working, private Drupal powered wiki.

Reed Kraft-Murphy

Read more posts by this author.