DokuWiki

It's better when it's simple

User Tools

Site Tools


namespaces

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
namespaces [2017-09-22 09:27]
113.21.228.134 [How to rename namespaces?]
namespaces [2017-12-05 10:46] (current)
141.65.129.171 old revision restored (2017-11-17 21:43)
Line 1: Line 1:
 +====== 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. For names of namespaces the same restrictions hold as for [[pagename|pagenames]].
 + 
 +A default DokuWiki installation comes with the built-in namespaces: //wiki// and //​playground//​.
  
 ===== Creating Namespaces ===== ===== Creating Namespaces =====
Line 6: Line 12:
 All namespaces used in your pagename that don't exist already will be created by DokuWiki automatically. All namespaces used in your pagename that don't exist already will be created by DokuWiki automatically.
  
-A namespace can be created in the media manager after having selected a file on the local computer and adding a ''​name:''​ (of namespace wanted) just before the media file name and then clicking ​ ''​upload''​. This will create on the fly the namespace (folder) for the file media, visible after a refresh of the windows. ​+A namespace can be created in the media manager after having selected a file on the local computer and adding a ''​name:''​ (of namespace wanted) just before the media file name and then clicking ''​upload''​. This will create on the fly the namespace (folder) for the file media, visible after a refresh of the windows.
  
 In DokuWiki pages are created as in every other wiki. Simply create a link to a non existing page, follow this link, and click on Create this page. See also [[.:​page#​create_a_page|Adding pages]]. In DokuWiki pages are created as in every other wiki. Simply create a link to a non existing page, follow this link, and click on Create this page. See also [[.:​page#​create_a_page|Adding pages]].
Line 32: Line 38:
 When all pages inside a namespace are removed (see [[page#​delete_a_page|delete a page]]) the namespace logically doesn’t exist anymore. DokuWiki usually deletes the now empty directory as well. When all pages inside a namespace are removed (see [[page#​delete_a_page|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.
 +
 +DISCLAIMER: I understand this is convoluted (and maybe I missed/​messed a couple of things you should also do). All in all this is a PITA. You may also use a couple of [[plugins]] that are available for (re)building the searchindex for the complete wiki, erasing entire cache and/or old wiki revisions thus avoiding having to do this manually.
 +
 +===== Namespace Default Linking =====
 +
 +It is possible to link to the default file of a namespace by ending the linkid
 +with a colon: %%[[foo:​bar:​]]%%. Which page the link links to is dependent on the
 +existence of certain named files. For %%[[foo:​bar:​]]%% the following pages are
 +checked:
 +
 +<​code>​
 +foo:​bar:​$conf['​start'​]
 +foo:bar:bar
 +foo:bar
 +</​code>​
  
 +The pages are checked in that order and whatever page is found first will be linked to. [[config:​autoplural|Autoplural]] linking is not done for those links.
  
 +DokuWiki supports [[doku>​Interwiki]] links. These are quick links to other Wikis.
 +For example this is a link to Wikipedia'​s page about Wikis: [[wp>​Wiki]].
namespaces.1506065232.txt.gz · Last modified: 2017-09-22 09:27 by 113.21.228.134