It's better when it's simple

User Tools

Site Tools


nspages plugin

Compatible with DokuWiki

  • 2013-12-08 "Binky" yes
  • 2013-05-10 "Weatherwax" yes
  • 2012-10-13 "Adora Belle" yes
  • 2012-01-25 "Angua" yes

plugin Present a table of content of the pages of a selected namespace

Last updated on


This plugin nicely displays a table of content of the pages -and optionally the subnamespaces- of a given (sub)namespace.

Using this plugin is easy: just write


and see the result. (You may also use the button from the toolbar.)

The general syntax is

<nspages path_to_a_namespace -option1 -option2 ...>


  • path_to_a_namespace represents the path to the wanted namespace. It can be an absolute (ex: namespace1:subnamespace) or a relative path (ex: .:subnamespace). If no path is specified, the current namespace is selected.
  • -option may be one of the following (it is possible to specify several options):
Common options
-subns displays the subnamespaces of the selected namespace (and provide links to their main page)
-nopages do not list the pages of the selected namespace (of course this option is useful only if you use -subns)
-exclude:nameOfPage won't include the page nameOfPage. This option may be use several times in order to exclude several pages
-exclude:subNs: won't include the subnamespace subNs. This option may also be used more than once
-exclude won't include the current page
-h1 will display the first h1 title found. If a page doesn't contain such a title, the name of the page is used instead
-textPages=“some text” some text will be displayed instead of the default text, to introduce the pages list
-textNS=“some text” some text will be displayed instead of the default text, to introduce the namespaces list
-title alias of -h1
-simpleList display the list on a single column
-simpleLine display the list on a single line (incompatible with -simpleList)
-nbCol=3 Change the number of columns to use (default is 3)
-sortId Sort the pages according to their id, even if -title is used
Less common options
-reverse Sort the pages in reverse order
-pagesInNs The pages will appear among the namespaces
-r recurse : display elements of the subnamespaces. You may use just ”-r” to check every subnamespace, or e.g. ”-r=3” to have a depth limit to 3 levels
-exclude:[page1 subNs: page2] an easier syntax to exclude several pages/subnamespaces
Enable the use of regex to select the documents that should be displayed. Eg: -pregPagesOn=”/doku/i” will display only pages which contains “doku” in their id.
Several options may be used, and each of them may be used several times.
-anchorName=myName Add anchors on each title-letters, to let link directly to them. Anchors will look like, e.g. for the letter A: nspages_myName_A
-actualTitle print an actual html title (not just a bold and underlined text)
-actualTitle=n print an actual html title <hn>

ex: <nspages path_to_a_namespace -exclude> or <nspages -subns -nopages> will work.


If you have one of the latest version of DokuWiki (at least 2009-12-25, Lemmings), you may use this archive:

Latest changes

Some (important) points

  • You should put ~~NOCACHE~~ in the pages where you use this plugin, to make sure that if you create or remove a page in the namespace, it will be taken into account. Else, it may take up to 24h to be updated. However, it's up to you: if you seldom create/remove pages, you may want to avoid putting this; to save CPU cycles.
  • The CSS sheet should be taken into account in order for this plugin to work correctly; but because of the cache system it may not be the case the first time you use this plugin (even if ~~NOCACHE~~ is specified). The easier way to resolve this is to make sure your cache is invalidated by touching conf/local.php (eg. by resaving your configuration)
  • Currently, you may not use a '>' in the -textPages and -textNS options, since it is understood as the end of the <nspages> tag


Are you having trouble with "this namespace doesn't exist"? Read on...

Chances are you've added the -textPages or -textNS option. I'll bet you even copy and pasted it from this very page. Unfortunately what's being displayed on this page is not as the author intended.

The quotation marks surrounding the “some text” example are being formatted on display as 'left and right double quotation marks'. This is significant here as the code sees these incorrect marks and does not recognize them. This causes it to misinterpret the supplied options.

To fix this, simply don't copy the options from this page. Write it by hand, directly into the wiki text entry window (don't use Word or other document editors either, as they can cause the same problem).

I have tested the 2011-08-25 version of this code with the latest stable version of DokuWiki (2012-01-25 “Angua”) and so long as you're careful of the input it works fine. :)

If you must copy, try these

-textPages="some text"  some text will be displayed instead of the default text, to introduce the pages list
-textNS="some text"     some text will be displayed instead of the default text, to introduce the namespaces list


2012/03/31 14:14

Persistent settings

Is it possible to set some settings persistently so that by clicking the button from the tool bar always these settings are inserted?

I use e.g. always these three settings:

  • -simplelist
  • -actualTitle
  • -exclude
No. But it would be an interesting feature.
You could add this feature request on the bugtracker.
I would also gladly accept a pull request.


2014/01/15 13:32
plugin/nspages.txt · Last modified: 2014/03/23 11:17 by 2a01:e35:1387:9c00:bc43:1660:b09b:dfb1