Site Tools


wiki:pluginsyntax:indexmenu

IndexMenu Plugin

IndexMenu allows you to insert a fully customizable index or a list of pages starting from a specified namespace.

Quick Syntax

:!: All the syntax options can be easily accessed with the indexmenu picker in the edit window toolbar.
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.

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 1) (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 2) (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
js JavaScript render method: the index is an expandable tree menu. Without n, all nodes are open, with it, nodes are open till n level.
navbar The tree opens itself automatically at the current page namespace. Useful in a navigation sidebar. It works with or without js option. 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.
context Relative main namespace and optional namespaces will refer to the current DokuWiki namespace context 3) instead of to the namespace of the page containing the indexmenu syntax. Useful in a navigation sidebar. It works with or without js option. In both cases, the indexmenu page is 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.
tsort Sort (only) pages by title. Useful when useheading is on. By default namespaces are not sorted, you need the nsort option for this.
dsort Sort (only) pages by date creation (first the oldest). By default namespaces are not sorted, you need the nsort option for this.
msort[#meta] Sort (only) pages by a custom metadata information. Without the meta parameter, it looks for the custom sorting number specified with the {{indexmenu_n>N}} syntax (see the below metadata tag syntax). meta should refer to the 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.
rsort Reverse the sorting of pages. By default namespaces are not sorted, you need the nsort option for this.
nsort Sort also namespaces according to page sort options. To use in addition to the above sort options. tsort option will apply to headpages.
nons 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.
nopg Exclude pages nodes from index. It shows only the namespaces.
max#n[#m] 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.
theme 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
id#[random|n] Cookie ID for a js indexmenu where the previously opened/closed nodes by a user are stored. Useful when a page is uncached and you don't use the nocookie option because it forces the same cookie preventing un-useful cookies created every time a page is viewed by the user. By default is always random even when this option is not specified, but you can force it to be a n fixed number ( i.e id#20 ). 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. It works only in js
maxjs#n 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
nocookie 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. It works only in js
noscroll Disable the JavaScript scrolling feature. It could solve visualization problems. It works only in js
notoc Disable the TOC-preview feature. It works only in js

Examples

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

{{indexmenu>:wiki:plugins#2|nons}}

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 4) opened at the second level .

{{indexmenu>playground#2|context}}

Show all current namespace pages .

{{indexmenu>.:#1|context}}

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:

{{indexmenu_n>N}}

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”).

Examples:

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

-Root
  |_don
  |_Mirror sessions         (headline title of the ":mirror" page)
  |_pachuco
  |_At the radar station    (headline title of the ":radar" page)
  |_van
  |_vliet

in this way:

{{indexmenu>..#1|msort}}
-Root
  |_vliet                   {{indexmenu_n>1}}
  |_van                     {{indexmenu_n>2}}
  |_don                     {{indexmenu_n>3}}
  |_Mirror sessions         (headline title of the ":mirror" page)
  |_pachuco
  |_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}}
-Root
  |_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)
  |_pachuco
1) , 2) , 3) , 4)
the namespace of the page displayed by a user who is navigating your site
wiki/pluginsyntax/indexmenu.txt · Last modified: 2018/05/28 22:29 by 127.0.0.1