User Tools

Site Tools


wiki:namespaces

Namespaces

A namespace is similar to a directory or folder, while pages are similar to files. In DokuWiki you can use namespaces to categorize your pages.

Creating Namespaces

Simply create pages with colons in the pagename. The token after the last colon will be the name of the page itself, while all other tokens are namespaces. All namespaces used in your pagename that don't exist already will be created automatically.

Examples:
example
.example
.:example
refers to the page “example” in the current namespace.
:examplerefers to the page “example” in the root namespace.
..example
..:example
.:..:example
refers to the page “example” in the parent namespace
wiki:examplerefers to the page “example” in the namespace “wiki”. The namespace “wiki” is located beneath the root namespace.
ns1:ns2:example
:ns1:ns2:example
refers to the page “example” in the namespace ns2. The namespace ns2 is located beneath the namespace ns1; the namespace ns1 is located beneath the root namespace.
.ns1:ns2:example
.:ns1:ns2:example
refers to the page “example” in the namespace ns2. The namespace ns2 is located beneath the namespace ns1; the namespace ns1 is located beneath the current namespace.
..ns1:ns2:example
..:ns1:ns2:example
refers to the page “example” in the namespace ns2. The namespace ns2 is located beneath the namespace ns1; the namespace ns1 is located beside the current namespace (i.e. both ns1 and the current namespace are beneath the same parent namespace, wherever according to the root namespace this parent may be located itself).
.ns1:ns2:
.:ns1:ns2:
refers to the page “start” in the namespace ns2. The namespace ns2 is located beneath the namespace ns1; the namespace ns1 is located beneath the current namespace.

(The default page can be named something other than “start” by adjusting the startpage configuration setting.)

Deleting namespaces

When all pages inside a namespace are removed (see delete a page) the namespace logically doesn’t exist anymore. DokuWiki usually deletes the now empty directory as well.

How to rename namespaces?

Manual way

In order to rename a namespace manually you will have to:

  • Rename the folders that represent the namespace in:
    • data/pages
    • data/media (if this exists)
  • Remove metadata for the namespace under data/meta
  • Remove attic data for the namespace under data/attic (or move that over as well, if you want to preserve old versions)

For example, on a Unix host, you could:

  • mv /dokuwiki_base/data/pages/old_namespace /dokuwiki_base/data/pages/new_namespace
  • mv /dokuwiki_base/data/media/old_namespace /dokuwiki_base/data/media/new_namespace
  • rm -Rf /dokuwiki_base/data/meta/old_namespace
  • move: mv /dokuwiki_base/data/attic/old_namespace /dokuwiki_base/data/attic/new_namespace
    or remove: rm -Rf /dokuwiki_base/data/attic/old_namespace

Note that the old_namespace and/or new_namespace words may need to be encoded if they are on a non-Latin character set (i.e. Greek, Russian, etc).

  • Correct (by editing them) all the links to the pages under the moved namespace (you can discover those before moving the namespace by reviewing each page's backlinks).
  • Browse each and every page under the new namespace. This will create the missing indexing information and metadata for the pages under the moved namespace.

However, you will still have lots of junk left around. For example in data/changes.log, various files under cache (including the .idx files etc). If possible you could just start from a blank state as follows (again under Unix) but be warned that this will mean losing all your historical information (i.e. recent changes):

  • cat /dev/null > /dokuwiki_base/data/changes.log
  • rm -Rf /dokuwiki_base/data/attic/*
  • rm -Rf /dokuwiki_base/data/cache/?
  • rm -Rf /dokuwiki_base/data/cache/*.idx
  • rm -Rf /dokuwiki_base/data/cache/purgefile
  • Browse each and every page of your Wiki.
wiki/namespaces.txt · Last modified: by 127.0.0.1