Table of Contents

IndexMenu Plugin

Compatible with DokuWiki

  • 2017-02-19 "Frusterick Manners" unknown
  • 2016-06-26 "Elenor Of Tsort" yes
  • 2015-08-10 "Detritus" yes
  • 2014-09-29 "Hrun" yes

plugin Show a customizable and sortable index for a namespace

Last updated on
Syntax, Action
Conflicts with
datatables, indexmenu2, tindexmenu

This plugin allows you to insert a fully customizable index or a list of pages starting from a specified namespace. It should be useful in DokuWiki sites where pages are organized by namespaces. Main features are:

Themed indexmenu based on the Javascript index builder:
Indexmenu based on Dokuwikis index builder:


The indexmenu plugin is not sponsored by anyone but I develop and support it for free during my spare time. If want to offer me a friendly beer 1), you can consider to make a donation.


Root namespace. Expands all {{indexmenu>:}}
Current namespace. Show only current level, don't expand any nodes. {{indexmenu>.#1}}
Parent namespace. Show parent namespace (“uplink”) and current level, don't expand any nodes. {{indexmenu>..:#1}}
wiki namespace, expand containing namespaces, not subnamespaces.
Using the themed Javascript indexmenu.


Basic syntax usage:

Main Options
{{indexmenu>ns[#n] [ns1[#n] ns2[#n] …] | [js[#theme]] [tsort] … }}

Arguments inside [] parenthesis are optional. The # char is always required with related options.

:!: All the syntax options can be easily accessed with the indexmenu picker in the edit window toolbar.

Full syntax

Settings before the “|” separator:

Main Action Note
ns Main namespace name. Index starts from here. Syntax complies with DokuWiki namespaces paths..” refers to the namespace of the page containing the indexmenu syntax and not to the current DokuWiki namespace context 2) (see the context option for this feature). “..” or an empty value shows the root site namespace.
#n n is a number that specifies how many namespace levels to display open under the main namespace. If it's not defined then the whole tree, till the deeper node, will be open. If 0 or 1 it'll display only nodes under the main namespace. For example: “#2” will display “root:myns1:myns2” but will keep myns2 closed thus hiding “root:myns1:myns2:myns3”. Optional.
ns1[#n] ... nsn[#n] A list of optional namespaces inside the main namespace. Every namespace will be opened or closed at the specified n level. Syntax complies with DokuWiki namespaces. If n is not defined then all namespaces are open, if 0 they are closed. “.” refers to the namespace of the page containing the indexmenu syntax and not to the current DokuWiki namespace context 3) (see the context option for this feature). “..” or an empty value shows the root site namespace. Optional.

Optional settings after the “|” separator:

Option Action Note
undo: nojs
JavaScript render method: the index is an expandable tree menu. Without the js option DokuWikis index renderer is used Without n, all nodes are open, with it, nodes are open till n level.
undo: #default
Theme name for indexmenu icons A theme is a set of icons inside images directory as described in Theme tutorial. Admins can download and share themes in admin panel. It works only in js e.g. js#tango
Next options are available with or without js option.
undo: nonavbar
The tree opens itself automatically at the current page namespace. Useful in a navigation sidebar. Without js option, the indexmenu page is never cached (just like the default DokuWiki index page) and the DokuWiki loading could be slower depending on the amount of child nodes displayed.
undo: nocontext
Relative main namespace and optional namespaces will refer to the current DokuWiki namespace context 4) instead of to the namespace of the page containing the indexmenu syntax. Useful in a navigation sidebar. The indexmenu page is now never cached so the DokuWiki loading could be slower depending on the amount of child nodes displayed (In js mode, when a lot of nodes are usually displayed, the max option is recommended). It automatically enable the nocookie option.
undo: notsort
Sort (only) pages by title. Useful when useheading is on. By default namespaces are not sorted, you need the nsort option for this.
undo: nodsort
Sort (only) pages by date creation (first the oldest). By default namespaces are not sorted, you need the nsort option for this.
undo: nomsort
Sort (only) pages by a custom metadata information. Without the #meta parameter, i.e. msort, it looks for the custom sorting number specified with the {{indexmenu_n>N}} syntax (see the below metadata tag syntax).
With #meta parameter you can refer to the meta data structure (Array values are managed through the “:” separator, for example: msort#date:modified).
By default, pages without metadata tag are sorted by page name (the default DokuWiki way), but you can override this behaviour adding also the tsort or dsort option in the indexmenu syntax. By default namespaces are not sorted, you need the nsort option for this.
undo: nohsort
Sort the headpages as defined by config setting startpage to the top msort overrules hsort
undo: norsort
Reverse the sorting of pages. By default namespaces are not sorted, you need the nsort option for this.
undo: nonsort
Sort also namespaces according to page sort options. To use in addition to the above sort options. tsort, dsort, msort, hsort apply only for namespaces when using headpages. rsort is applicable always together with nsort.
undo: ns
Exclude namespaces nodes from index. It shows only the pages. Without js, the closing n namespace option prevents to display nodes below the n namespace level.
undo: pg
Exclude pages nodes from index. It shows only the namespaces. All namespace nodes will link to the start pages (as defined by startpage setting)
skipfile[+|=]/regexp/ Skip files matching the regexp. skipfile+/../ skips files defined with this regexp additional to global skip config. skipfile=/../ replace the global skip config with regexp from this syntax. See the global config explanation for some regexp examples.
skipns[+|=]/regexp/ Skip namespaces matching the regexp. Just like skipfile, but namespaces.
Next options are only available with js option.
undo: nomax
If initially closed, the node at n level will retrieve all its child nodes through the AJAX mechanism when opened for the first time. Optionally, the nodes after the n level can be retrieved with AJAX every m sublevels instead of in one go. It affects the server loading and speeds up the loading of pages in DokuWiki with an high amount of pages. It works only in js. Cookie are automatically disabled, just like with nocookie.
undo: nomaxjs
It sets how many js tree levels to render when page loads. Remaining nodes are rendered (slightly slower) only when they are open by users, by optional namespaces option, by cookies or by navbar option. Default n is 1 so that it will speed up the page loading, above all with an high amount of pages. It affects only the user-client CPU speed, not the webserver load. It works only in js
undo: id#random
Cookie Identifier for a js indexmenu where the previously opened/closed nodes by a user are stored. Useful when a page is uncached and you like the tree state is stored in cookie. (See nocookie for disabling cookies.) Default the option id#random is active, also when the option is not specified in the syntax. You can apply self a number as unique identifier for your indexmenu ( e.g. id#20 ) or let generate a number unique for requested namespace with id#ns. Read the Js does not remember its previous state section. ATTENTION: ID must be unique for every indexmenu in your DokuWiki site or you'll get strange js behaviors. Tree state storage with cookie only in js
undo: cookie
Disable cookies. By default js indexmenu remember selected,open and closed nodes by user during navigation. With this option it doesn't remember them and the tree is blocked to its start status. Tree state storage with cookie only in js
undo: scroll
Disable the JavaScript scrolling feature when it don't fits the container width. It could solve visualization problems. It works only in js
undo: toc
Disable the TOC-preview feature. ToC preview only available in js
undo: menu
Disable the contextmenu feature. Context menu only available in js


A sample of an indexmenu JS index that could be used inside a navigation sidebar. Its initial status is blocked by the nocookie option, so, when the page is reloaded, it doesn't remember the open and closed nodes by the user.:

{{indexmenu>..#1|js navbar nocookie}}

JS navigation index with “thread” theme where nodes after the third level are retrieved with Ajax every 2 sublevels. Pages are sorted by title and custom sort number:

{{indexmenu>..#1|js#thread navbar max#3#2 tsort msort}}

Standard DokuWiki index showing only pages inside wiki:plugins and lower namespaces (max two levels):


Js tree showing pages and namespaces both sorted by reverse title. For example,if “archive” contains stuff (“news”,“oldnews”,etc) that you need to quickly organize by time, you could create numbered headpages for every namespace (i.e renaming “oldnews” in “news 2006”, “news” in “news 2010” and so on) and sort them from new to older:

{{indexmenu>:archive#1|js tsort nsort rsort}}

Standard index showing the tree of the current context 5) opened at the second level .


Show all current namespace pages .


JS tree showing all (and only) the namespaces of the “private” namespace sorted by date creation. “private” is relative and refers to the private namespace under the page containing the indexmenu syntax.

{{indexmenu>private|js nopg dsort}}

Metadata tag syntax

By default nodes on the same tree level are sorted by name (or by title/date if you use the tsort/dsort syntax), but you can also specify a custom sort number for every page inserting a metadata tag in the pages with this syntax:


Where N is a number. Then you need to use the “msort” option in your indexmenu tree syntax. If you have the show_sort option enabled in the Configuration Manager, a notice is displayed to admins (only) on every page with this metadata tag (the text defaults to “Indexmenu sort number: N”).


You can change the order of this tree containing a mix of standard and useheading pages:

  |_Mirror sessions         (headline title of the ":mirror" page)
  |_At the radar station    (headline title of the ":radar" page)

in this way:

  |_vliet                   {{indexmenu_n>1}}
  |_van                     {{indexmenu_n>2}}
  |_don                     {{indexmenu_n>3}}
  |_Mirror sessions         (headline title of the ":mirror" page)
  |_At the radar station    (headline title of the ":radar" page)

Pages without sort number, like the last three pages, are sorted by page name as default, but you can force a different sort:

{{indexmenu>..#1|tsort msort}}
  |_vliet                   {{indexmenu_n>1}}
  |_van                     {{indexmenu_n>2}}
  |_don                     {{indexmenu_n>3}}
  |_At the radar station    (headline title of the ":radar" page)
  |_Mirror sessions         (headline title of the ":mirror" page)

Configuration options

Indexmenu is fully configurable from Configuration Manager. Options are explained in the below sections.

Default options

Default options let you define settings that are applied to all the indexmenu indexes included in pages. To undo any syntax option, use the inverse version of the option. Normally that option is the same but with or without no... See the table above for all undo options.

Only admins

It prevents no-admin users from inserting indexmenu trees, removing every indexmenu syntax in the page. It affects only the edit mode, so that standard users are still able to view indexmenu tree in a page edited by admins.

This is useful to deny to insert indexmenu trees to your users, but pay attention that if you let them to edit a page containing an indexmenu tree inserted by the admin, this tree will be removed as soon as a standard user saves the page.

ACL Cache

Optimize the cache of indexmenu according to ACLs and prevents to display unauthorized nodes.

The choice of the method affects only the visualization of nodes on the indexmenu tree, not the page authorizations. The Groups option is the default setting.

If wrongly set, this option could display to a group of users (ie. the anonymous user) the cached tree of another group (ie: the admin user), thus displaying randomly different trees containing less or more (un)authorized nodes.

There are also important issues in about ACLs and about_empty_namespaces that affects trees limited by ACLs.

Titles for page headings

First of all, if you want that the whole tree displays the heading title of pages instead of their name, you need to set the config setting useheading on in the general configuration of the wiki. Indexmenu will show page titles when useheading is 'always' or 'navigation'.

Title for namespaces headings

Next, if you want that the namespace nodes display a heading title instead of the namespace name, you need to select the page from which these are retrieved with the config option headpage.

Every namespace will retrieve its title from the heading title of that page, called headpage, and will be linked directly to it. No longer you can open the node by clicking the header (in the js version you can still use the plus before namespace).

You can choose a name for the page from which retrieve the title or use a self defined value:

Value Page Example
any value The page inside the namespace public(ns):myvalue(page)
:inside: a page with the same name of namespace, beneath the namespace public(ns):public(page)
:same: a page with the same name of namespace, at the same level of the namespace public(page) ⇔ public(ns)
:start: the global start page name inside the namespace public(ns):start(page)

You can specify more than one option using “,” as separator. For every namespace, every value will be checked till the first existent headpage is found.

Hide headpages in tree

To get a better visualization you could use the hide_headpage option, that hides headpages, such as defined by config headpage, in the rendered indexmenu tree.

Page index

When this option is not empty, the DokuWiki default index page is replaced with a custom page, which you can fill yourself. For example you can add the indexmenu tree of your site.

Set this option with a DokuWiki page ID (i.e: tools:index), then create the page (i.e: tools:index) and put inside it an indexmenu syntax like this:



{{indexmenu>..|js navbar nocookie}}

You may also want to hide this page in any indexmenu trees with the skip files in index option.

Empty message

You can show a custom message in place of the menu tree if it can not be rendered (i.e namespace doesn't exist)

The alias {{ns}} is a shortcut for the requested namespace.

Message supports the wiki syntax, so it's fully customizable. Don't use HTML code.

Skip Namespaces in Index

The configuration setting skip_index let you globally hide namespaces (and their pages) in your indexmenu trees.

Just fill this option with the ids of namespaces to skip using Regular Expression.
:!: Till V4.5, a namespaces full path has to be declared as a file system path (i.e.: “mydir/mysubdir”) instead of DokuWiki IDs.

There are also some issues About empty namespaces that should be read.

Simple examples:
Skip any namespace whose ID contains the word copyright or privatens:users. Attention: allprivatens:usersmich will be also matched


Skip the namespace whose ID is exactly myusers:spaces. Here the characters ^ and $ marks the start and the end of the matched string.


Skip Files in index

This configuration option skip_file let you to globally hide one or more pages in your indexmenu trees. Just fill this option with the ids of pages to skip using Regular Expression.
:!: Till v4.5, pages are checked as DokuWiki text files (i.e.: start.txt). A page full path have to be declared as a file system path (i.e.: “mydir/start.txt”) instead of DokuWiki IDs.

There are also some issues About empty namespaces that should be read.

Show sort

If you sorted a page with the metadata tag syntax, a short blob message at the top of page will display its sort number.

The message is displayed only to wiki admins when they view the page.

How to install

Search and install it in the Extension manager or download and unpack it into lib/plugins folder.

Alternative download link:

Old releases


:!: You could need to purge your browser and server cache after upgrading it, following these instructions. The full changelog can be viewed at my indexmenu page.
Many thanks to Klap-inKlap-in

, all the work for the 5.0 release was done by him.

Github changelog

Release changelog


For development separated branches of the code are created to test features and bug fixes. See the list of current branches:

Before installing a development version be sure to have first manually deleted the old indexmenu directory. Also be sure that, as last step, server/client cache is purged following 4 and 5 of the the tree is not displayed section.


At this moment some languages are supported , but I'll be glad if you want translate indexmenu in your own language. Please refer to translation tool at to translate the strings of the indexmenu plugin. Thanks!

JavaScript themes

With the option js you enable the JavaScript tree menu, for which you can chosen some themes. When the js option is used without #theme option, the JavaScript indexmenu will use the default theme.

Inside the Admin panel on the Indexmenu Utilities page you can manage the available themes on your installation and install themes from the public indexmenu repository. To download themes directly into your DokuWiki server, you need that the indexmenu images directory is writable by the web user.

Instead of installing you can also simply download a theme into your PC with the download link, and then manually install it.

The JavaScript tree menu is based on dTree code.

Theme tutorial

You can create custom themes for every index rendered with the dTree menu.

Simply create a subdirectory, for example mytheme, inside indexmenu/images and put inside it your icons following the default theme scheme:

Icon Type Example: theme 'default'
base.gif Root Folder
folderopen.gif Open folder without URL link
folder.gif Closed folder without URL link
folderhopen.gif Open folder with URL link (headpage)
folderh.gif Closed folder with URL link (headpage)
page.gif Page
empty.gif blank image to fill gap between lines

Use your theme with js#mytheme syntax.

You can also customize a theme style further by creating its own css style as style.css file in theme folder next to the images.

The default icons file format is GIF, but PNG and JPG are also supported. To use them in place of GIF, you have to name your theme directory with the appropriate image extension. For example: mytheme.png/base.png. Default image size is 18x18px. Other sizes are possible, but requires additional css.

The context menu

An action menu is displayed when using the context mouse menu click (the right one in many cases). On Opera you can use the CTRL+left click to display it. When in editing mode, by default an “Insert as DWlink” item menu is added to the menu in order to insert the node DokuWiki link in your editing box. A different context menu is loaded depending on anonymous, authenticated or admin users.

In the April 2013 release of the plugin the contextmenu definition is bundled in scripts/contextmenu.js. Be aware this file is overwritten on update of the plugin. Therefore an additional file scripts/contextmenu.local.js is provided, you need to change this file to modify the appearance of the contextmenu.

Since the April 2013 plugin release you can add the nomenu option to indexmenu syntax to disable the contextmenu.

Modification of menu in performed in scripts/contextmenu.local.js:
(You can rename the example file from scripts/contextmenu.local.js.example)

Some details about Array.splice(entryIndexNo, howManyToRemove, entryDescriptionArray) (documentation):

How to write utf8 chars, like èåäö, in the context menu file?
A solution is to encode them yourself: Find your char at, replace the last zero of the left code by the character in the upper row and prepend the result with \u : i.e. \u00E3 for 'ã'

In the releases before April 2013, you could fully customize those menus by editing these files in the 'jsmenu/' directory:

File Loaded by
“menu.js” anonymous user
“usrmenu.js” authenticated user
“admmenu.js” admin user6)

And to prevent to load the context menu, simply remove the indexmenu_contextmenu variable declared in the above menu files.

CSS Style

You can override styling from the style.css in order to globally customizing the tree menus style. Therefore you create (or extend) [wiki directory]/conf/userstyle.css with your own css. (See also css).

Some styles are:

Tag Comment Mode
a.nodeFdUrl Namespace with URL link (headpage) js
a.node Namespace without URL link js
a.nodeUrl Page js
a.nodeSel Previous selected page or headpage highlight js
a.navSel Current page highlight js
a.indexmenu_idx_head link style of a namespace with URL (headpage) nojs
a.indexmenu_idx link style of a namespace without URL nojs
.indexmenu_arrow The scrolling arrow area js
.indexmenu_toc The toc-preview area js

Custom theme CSS style

If you want to apply a different style then the global one to a js theme, you need to create a style.css file like this inside the theme directory you want customize and use its name as subclass.

FIXME check if this example is still up-to-date. For example you could add for the 'thread' theme:

/*Custom style for the thread theme*/
  font-family: Comic Sans MS;
.dtree.thread a.navSel {
  background-color: #000;
  color: #fff

Existing example for 'human.png' theme: style.css.

Note: in about June 2014 the css of some .dtree related stylesheet lines is changed. This can break your styling. Please use the latest version of indexmenu, and review your styles. A look at the CSS changeset could be useful.

FAQ and Notes

The tree is not working as expected

The tree is not displayed

Follows these instructions:

  1. To have installed an indexmenu release compatible with your DokuWiki version as described in how to install.
  2. To have the last indexmenu version installed. For example check that its date is the same of changelog last release through the info button in plugin manager.
  3. To have used a correct syntax.
  4. To have purged your browser cache. Use Ctrl + R or Ctrl + F5
  5. To have purged server cache following the purging_the_cache instructions.:!: This is an important step.
  6. To have purged CSS and JavaScript as cached by DokuWiki. Go to the Configuration Manager and just resave, to refresh this caching.
  7. When you try the javascript version of the indexmenu and it fails, please disable all the self-installed plugins check if now works. Nextly, you enable the plugins one-by-one to find the bad one.

If problem still persists, please, report the bug with details of your configuration in reporting_feature_requests_and_bugs section.

DokuWiki is getting slow

If your site contains a large amount of pages, and you're using indexmenu as a navigation sidebar, you could notice random slowdowns in the page loading.

This happens when cache is purged and the whole indexmenu tree has to be rebuilt.

To avoid this problem you may use the max option, which rebuilds only a single tree portion (sublevel) and enable AJAX for further user-requested sublevels.

Indexmenu ID conflict

I have in my sidebar the following code

{{indexmenu>..#1| js navbar id#random }}

and I get after saving this message: Indexmenu ID conflict. What's wrong?

A conflict happens when there are two indexmenu tree with the same ID in a web page.

When you just edited the sidebar page, your sidebar & your content page are the same, so its content is displayed twice. When it contains a indexmenu, this index is also shown twice. This is no problem because normally you don't visit the sidebar as normal wiki page.

When you have a sidebar defined a sidebar, but it is used as normal page too e.g. an index page, it is recommended to create a separate page for the index page. A separate page prevents displaying same index twice so they can not conflict anymore. The index page may have the same syntax options as the sidebar, but when you use id with a self defined id#identifier, your identifier must be different.

Can I sort the tree nodes (filename or page heading or creation time)?

Yes, You can sort pages with the tsort, dsort or msort syntax options. To sort namespaces you need to add the nsort option to previouses.

How can I activate the indexmenu as sidebar for every page?

  1. Enable the sidebar function in your template. See FAQ sidebar for configuration and installing.
  2. Add the indexmenu to the page used as sidebar.

Indexmenu provides only the index, for configuration of e.g. visibility of the sidebar itself you have to look in the features of the different sidebar solutions.

The tree is not updated

The tree is always immediately updated. So you have not to worry to use ~~NOCACHE~~ instruction, it's not useful and slows down the page loading.

To purge cache either wait for the automatic purge cache time expiration or force it through a purge=true request on the page that contains the indexmenu tree.

JS does not remember its previous state

Every js indexmenu has an identifier (randomly generated by default) used by cookies to remember the current tree state (the selected, open and closed nodes). When the page cache expires or is purged, this information is reset because a new cookie (and consequently a new identifier) is generated.

This is not a problem because cache purge is not frequent, but if indexmenu is called inside an uncached page or directly inside PHP code, every time an user loads the page, indexmenu behaviour is to not remember its previous state just like when nocookie is defined.

In this case, the solution is to force a permanent identifier through the id#identifier option. The identifier can be any number or the string “ns”. The last option is used in rare case, because it will generate an ID based on the chosen main namespace. It's important to have unique ids in your site because two menus with the same identifier will interfere with each other when the user opens or closes nodes.

I don't like the tree sliding arrow

Create your own arrow in GIF format with an image editor, then override the default one in dokuwiki/lib/plugins/indexmenu/images/scrollleft.gif. Change the height and width of the .indexmenu_arrow property in the Css Style according to the size of your image.

You could need a browser cache purging.

About ACLs

:!: First of all, you could need to correctly set the Acl cache option in order to avoid displaying of denied pages.

Indexmenu tree behaviour depends also on the sneaky_index option in this way:

In both cases, unauthorized pages are never showed. There are also some issues About empty namespaces that should be read.
This namespace behaviour in presence of ACLs can not be changed until it's not changed in the DokuWiki core itself.


+-Mysite         (ns) (allowed)
 +-private       (ns) (denied)
   +-ppublic     (ns) (allowed)
     -ppstart    (page) (allowed)
   -pstart       (page) (denied)
 +-public        (ns) (allowed)
   -linux        (page) (allowed)
 +-public2       (ns) (allowed)
   -secret       (page) (denied)
 -start          (page) (allowed)
 -start2         (page) (denied)

Enabled will display:

+-Mysite         (dir)
 +-public        (dir)
   -linux        (page)
 +-public2       (dir **displayed only in case of any sort option**)
   -X           (empty/unauthorized icon **displayed only in case of any sort option**)
 -start          (page)

Disabled will display:

+-Mysite         (dir)
 +-private       (dir)
   +-ppublic     (dir)
     -ppstart    (page)
 +-public        (ns)
   -linux        (page)
 +-public2       (dir **displayed only in case of any sort option**)
   -X           (empty/unauthorized icon **displayed only in case of any sort option**)
 -start          (page)

About empty namespaces

Empty namespace can occur when:

When the max#nr option or level of folded nodes are configured and the node has to retrieve its children through the Ajax request, there can appear empty nodes because indexmenu hasn't looked forward and doesn't know yet that the node was empty.

Why do you need a sort option to correctly hide empty namespaces?
When any of the sort options tsort, dsort, msort nsort or hsort is used indexmenu replaces the faster, but less featured, core DokuWiki search with the slower, but more featured, indexmenu search that filters more empty nodes.

Why will sneaky_index hide forbidden namespaces
Enabling the sneaky_index also checks for access to forbidden namespaces, instead of only checking access to pages. This means that it hides deeper allowed pages or namespaces as well. These nodes aren't reachable via the index anymore.. See also About ACLs.

I'm using "useheading" but the tree displays namespace and page names rather than headings

The text used for the nodes in the tree is retrieved from DokuWiki's metadata store. DokuWiki uses a background process triggered by a web-bug to updating this metadata.7) If you added wiki pages/namespaces via the filesystem (rather than creating them in DokuWiki,) and that page/namespace has never been viewed, the metadata will not have been generated.

Reporting feature requests and bugs

Please refer to to share your feature requests and bug reports.

See also for additional info:


Please, use the discussion page for feature requests and general discussion.
Old discussions are archived in the olddiscussion page.

2) , 3) , 4) , 5)
the namespace of the page displayed by a user who is navigating your site
See indexer.