Improving the Web Index in Foswiki using the Filter Plugin

August 15th, 2009  | Categories: Software  | Tags:

In a standard Foswiki setup there is a topic in every web called WebTopicList, which is linked to from the side bar as Index. By default it simply lists all the topics in one big list, as shown below (or view on foswiki.org):

old-webtopiclist

This certainly isn’t very elegant. Luckily by using Michael Daum’s Filter Plugin we can improve the index by giving it some structure and making it more like a directory, as shown below:

new-webtopiclist

To do this we only need to make a small change to the WebTopicList in the System web. Since all the other webs simply import that page the changes will be immediately visible across the wiki with just the one change.

Edit the WebTopicList topic and replace this line:

%TOPICLIST{"   * [[%BASEWEB%.$name][$name]]"}%

With this:

%MAKEINDEX{"%TOPICLIST{"$name" separator=","}%" cols="3" header="$anchors" format="[[%BASEWEB%.$item][$item]]"}%

Thats it! You now get a much more friendly and useful index in all of your webs.

Note: This tip has also been made available on foswiki.org.

  1. August 16th, 2009 at 19:41
    #1

    I’m running latest Foswiki and FilterPlugin on most current version of MacOS Tiger, all patched to recent, and perl 5.8.6. Tried doing this trick to WebTopicList, but got “Insecure dependency in require while running with -T switch.”

    I fixed it by adding
    $Foswiki::cfg{UseLocale} = 1;
    to LocalSite.cfg

    Is that a reasonable thing to do to fix this?

  2. Andrew Jones
    August 16th, 2009 at 21:16
    #2

    Erm I don’t know, strange error to get as the Filter Plugin isn’t that complicated. Might be something to do with your platform and/or version of Perl. Im using Perl 5.10 on Debian Linux with $Foswiki::cfg{UseLocale} = 0;.

    I doubt having UseLocale on will have any side effects, but you could always ask a question on foswiki.org.

  3. August 17th, 2009 at 10:00
    #3

    @Fil, yes that’s a commonly seen error on some perls. Switching on UseLocale does work around it and I use this trick myself frequently … not that I know _why_ that fixes the error …

TOP