Namespace manager

This feature is currently not available in the MediaWiki SVN trunk but in the 'wikidata' branch, and was intended to ship with a future version of MediaWiki.

In a future version, namespaces in MediaWiki can be configured, added and deleted using a special page, Special:Namespaces. This version also adds several new features for namespaces, and they are now stored in the database, allowing for integrity checking of all changes. Besides configuring regular namespaces, the namespace manager can convert so-called "pseudonamespaces" into real ones. Access to this page is, by default, limited to bureaucrats.

While care has been taken to make all operations in the namespace manager reversible, it should only be used in full understanding of the possible consequences of each operation. If you are not the ultimate authority of your wiki, also consult the wiki's policies before making any changes.

When to create namespaces
See the namespace help for a general description. Namespaces can segregate very different types of content that may exist under the same title. Generally, namespaces should not be used to categorize content of the same type -- that is what categories are for. The namespaces that come with MediaWiki illustrate this "content type" distinction:
 * The main, unprefixed, namespace is for the primary content to be maintained in the wiki.
 * The talk namespaces are for discussion.
 * The project namespace is for policies, votes and meta-information.
 * The file namespace is for file descriptions.
 * The MediaWiki namespace is for user interface texts.
 * and so on.

So, when should you create a custom namespace? Essentially, if you have a type of content which you feel is substantially different from the content in the existing namespaces, you may want to consider creating a new namespace. In the world of the Wikimedia projects, for example, several wikis have a "Portal" namespace for entry pages to particular topics. In Wikibooks, there is a "Cookbook" namespace, because unlike other Wikibooks, cookbooks consist of many hundreds of separate recipe pages. On Meta, there are "Help" namespaces for the MediaWiki documentation in different languages.

Namespaces are also a core component of the Wikidata project, which is under active development. In the context of Wikidata, they are intended to segregate different types of structured content, such as person data, country information, music albums, etc.

Note that, using the default prefix feature and the filtering in Recent changes and user contributions, namespaces can make it possible to treat a wiki as if it consisted of several fairly separate sub-wikis. Note, however, that neither the namespace manager nor the rest of MediaWiki have been written to accommodate a very large number of custom namespaces, and you may run into scalability issues if you do create them.

Adding namespaces


The first component of the namespace manager is used for creating new namespaces. If you fill in the namespace name, with JavaScript enabled, an appropriate talk namespace name should be inserted by default (note that this requires the namespace manager interface messages to be translated into the language you are working in). You should almost always add a talk namespace for a new namespace you create, unless you want to use an existing one. Once you click the "Add namespace" button, the new namespaces will be created with the names you have given. If there are any name conflicts, no changes will be made, and the errors will be shown.

Changing namespace definitions


Below the "Add namespace" form, there should be a list of all namespaces in your wiki. The namespace properties are shown differently, depending on whether the namespace you want to modify is a system namespace, a special namespace, or a custom namespace:


 * System namespaces are those prefixes which MediaWiki expects to be there in order to function properly. Some of them, such as the "File:" namespace and the "Category:" namespace, are tied to specific functionality. Their internal IDs must not change, and they cannot be deleted.


 * Special namespaces (currently "Media:" and "Special:") are system namespaces which do not contain pages. Instead, together with a name, these prefixes provide access to special features of the software ("Special:") or allow you to create a direct link to an uploaded files ("Media:"). Because they cannot contain pages, the namespace operations relevant to page content are not available for these namespaces.


 * Custom namespaces are those namespaces which have been created through the namespace manager, and which do not come with MediaWiki by default. They can be deleted if they do not contain any pages.

Namespace properties
All non-special namespaces have the following properties:
 * Support subpages. Should links of the form /My subpage lead to a page Title/My subpage with a backlink to Title ? This is typically used for talk pages, where subpages are a convenient way of archiving old discussions.
 * Search by default. Should pages in this namespace be searched by default when a term is entered from the "Search" box? If this is not set, it is still possible to search the namespace. Note that changing this setting does not affect existing user accounts, who may have other preferences.
 * Hide in lists. Should this namespace be hidden from the namespace selector in the user contributions and recent changes list? Note that this will not hide the namespace from the selector on Special:Allpages, to make sure that pages can still be easily located. The primary use is for wikis with many namespaces or for content that is largely of internal interest.
 * Default link prefix. Links from this namespace to other pages which do not have a prefix will be treated as if they were prefixed with this text. For example, if this was set to "User", a link in the given namespace Dogmaster3000 would be rendered as if it was written Dogmaster3000 . The most common use for this is namespace-internal linking. For example, it could be assumed that any unprefixed link in the "Cookbook" namespace points to another recipe, rather than a page in the Main Namespace. If this setting is changed, existing links may break, however, this is not irreversible. If this is set, you can refer to the unprefixed main namespace by using the syntax Title . Edit pages in namespaces with this configuration option will explain the link behavior to avoid user confusion. The prefix can be anything, including interwiki or interlanguage prefixes.
 * Discussion namespace of. MediaWiki currently supports one discussion namespace per namespace, however, it may support multiple such references in the future. The discussion namespace associated with any namespace can be accessed through the user interface (default skin) from the "Discussion" tab. Note that discussion namespaces, like all others, must have distinct names.

Namespace names
Every namespace type can have an arbitrary number of names; these are shown in the middle column of the namespace manager. One of these names is the default name (selected via a radiobutton) to which all other namespaces redirect. That is, if you have the namespace names "File:" and "Image:", and "File:" is the default namespace, a link to "Image:Picture.jpg" will show "File:Picture.jpg" in the URL and title.

System namespaces also have a canonical English name through which they can be accessed on any MediaWiki installation. Canonical names cannot be modified. The canonical name does not have to be the default name, and indeed, in non-English installations it most certainly is not.

In order to delete individual names, tick the matching checkbox, and submit the form. In order to add new names, fill in one or more of the three blank rows.

Deleting namespaces
Because MediaWiki relies on the presence of system namespaces like "File" and "Category" throughout the code, these cannot be deleted. Only non-system namespaces which do not contain pages can be deleted through the namespace manager. This is to ensure that any deletions are easily reversible.

Converting pseudonamespaces


Sometimes, users do not create namespaces in the proper fashion, and instead simply link to pages with a prefix such as "Portal:". If there is no matching namespace name, MediaWiki will treat the "Portal:" as part of the page title. This prevents titles like "2001: A Space Odyssey" from being interpreted as namespaces. While the ambiguity in the syntax could be considered a defect, it is a legacy that will likely not go away.

For this reason, the namespace manager can convert these pseudonamespaces into real ones. In order to do so, the prefixes are stripped from the titles, and the pages are sorted into the right namespaces. If the target namespace is empty, this operation can be reversed through an SQL query. However, for non-empty target namespaces, it is very difficult to automatically reverse. For this reason, there is a separate permission setting called "merge_pseudonamespaces" in "includes/DefaultSettings.php" to restrict access to the "Merge into a namespace that contains pages" feature. In any case, if all else fails, pages can be moved back manually if there is no naming conflict.

Note that if you want to add a new namespace with a name that conflicts with an existing pseudonamespace, you will get a naming conflict. This is because the pages in the pseudonamespace would otherwise become temporarily inaccessible (a situation that users of past MediaWiki versions may be familiar with). In order to make the transition, first create a namespace with a different name, convert the pseudonamespace, and then rename the namespace again.

Download
This feature is currently available in a special branch of MediaWiki via SVN called 'wikidata'.
 * http://svn.wikimedia.org/svnroot/mediawiki/branches/wikidata - http://svn.wikimedia.org/viewvc/mediawiki/branches/wikidata/

WikiData is currently in use on OmegaWiki.org, a multilingual translation dictionary. http://www.omegawiki.org/Development

There is also a less-capable stand-alone extension which may be used to preserve these custom namespaces after upgrade to a core MW1.8-1.16 installation.
 * Extension:SpecialNamespaces