Adding Talk / Discussion Pages To Trac

I’m a big fan of wikis in general. This week I implemented one to help organize the Athlo project. There are literally dozens of wikis to choose from, but ultimately I went with Trac as it has built in milestone management and is super easy to install on Fedora.

One thing that bothered me was the lack of discussion or talk pages. Luckily, Trac is built on Python and uses the ClearSilver template engine so hacking in this functionality was very easy. Here’s what I did.

In the /usr/share/trac/templates folder, there is a file called wiki.cs. It is the template that defines the wiki (duh). Around line 28, the code looks like:

/usr/share/trac/templates/wiki.cs
  • Start Page
  • Index by Title
  • Index by Date
  • Last Change
  • This defines the links that appear just under the main menus that appear horizontally in the default layout. To add talk pages, I simply modified the code like this:

    /usr/share/trac/templates/wiki.cs
    	
  • Start Page
  • Index by Title
  • Index by Date
  • Last Change
  • Talk
  • Note that last part. It simply checks to see if you’re on a Talk page already. If not, if creates a link on the text Talk. If you’re viewing SomeWikiPage, the link will point to Talk:SomeWikiPage. If you’ve ever used wikipedia, it should be very familiar.

    What’s nice is this same technique can be used to create any number of meta pages. Happy trac’ing and hacking.