You're viewing a single post. I have much more to say! The main blog page is a good starting point.

Trac SiblingNav plugin

Recently I’ve become a fan of using Trac for various projects I’m involved with, both professional and personal. The only issue I’m repeatedly having is the lack of a useful navigation box for hierarchical wiki pages. Existing navigation macros and plugins just don’t fit my needs, since they require you to build a menu yourself or make wrong assumptions. Fortunately, writing a plugin is not that hard…

I’m presenting you my shiny new SiblingNav plugin for Trac (tested with version 0.10.4). It looks like this on a subpage in a hierarchial wiki structure:

Trac SiblingNav plugin

This plugin adds a [[SiblingNav]] wiki macro resulting in a listing of the wiki path leading to the current page and a list of sibling pages. This is only useful for a hierarchic wiki structure, e.g. Meeting/20080218 is a subpage of Meeting. This plugin does the right thing for both top pages and subpages.

The macro accepts an optional argument with the page prefix for which to build a navigation menu, e.g. [[SiblingNav(Meeting)]] If omitted, the current page name is used. This covers the vast majority of use cases.

The output is modeled after the standard trac navigation and some other plugins, i.e. it uses the wiki-toc class on the surrounding HTML div, so it should show up as a familiar navigation pane.

You can get this plugin by either branching the Trac SiblingNav Bazaar branch like this:

bzr branch

...or alternatively by just copying the file to your wiki-macros/ directory.

I’ve listed the plugin at the Trac Hacks site as well so it’s more easily found by fellow Trac users: SiblingNav at TracHacks

Give it a try if you’re looking for something like this! Feedback is welcome!