Skip to main content

Improving the Web Index in Foswiki using the Filter Plugin

·1 min

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):

A screenshot of a computer screen displaying a wiki-style webpage with a navigation menu on the left side. The menu includes sections labeled "User," "Admin Maintenance," "Categories," and "Webs," each with multiple clickable links in blue text. The links are organized under headings in bold, with some headings in red. The background of the page is white, with black text for the main content and blue links. There is also a color-coded legend at the bottom left indicating different web categories.

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:

A screenshot of a webpage with a list of links organized alphabetically into sections labeled A, B, C, D, and E. The list includes various topics such as user reference, categories, web tools, plugins, and system requirements. The links are displayed in blue and are grouped under section headings marked by single capital letters. On the left side, there is a color-coded legend indicating different web sections: Main, Perl, Sandbox, System, TWiki, and Trash.

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.