Manual:Namespace

A namespace is a collection of pages which have content with a similar purpose, i.e. pages where the intended use is the same. Namespaces can be thought of as partitions of different types of information within the same wiki, and keep "real" content separate from user profiles, help pages, etc.

Technical overview
Pages exist within a namespace, and this can be distinguished using the namespace prefix of a page, which forms part of the title of a page, separated with a colon (:).

For example:

The "main namespace" does not have a prefix. Also, pages in the main namespace cannot have names starting with any of the existing namespaces prefixes followed by a colon.

Pages can be h-movepg>Special:MyLanguage/Help:Moving a page|moved between namespaces simply by changing the prefix part of their title.

Namespace prefixes can be translated, and aliases can be configured for each (see ns-alias>Special:MyLanguage/Manual:$wgNamespaceAliases|$wgNamespaceAliases). All namespaces also have a "canonical" prefix, which works on all wikis regardless of configuration. Aliases and canonical names can be used in links, when performing a h-search>Special:MyLanguage/Help:Searching|search, and in the page title with the help of the h-magic>Special:MyLanguage/Help:Magic words|magic word.

Each namespace has a corresponding namespace index. Within the database, the title is split into namespace index and text title, and this is used for storage in the page.page_namespace and page.page_title columns, among others.

Subject and talk namespaces

 * See h-talkpg>Special:MyLanguage/Help:Talk pages|Help:Talk pages for instructions on how to use talk pages.

Most namespaces have an associated discussion namespace (or "talk" namespace). All discussion namespaces have odd-integer indices, and the discussion namespace index for a specific namespace with index n is n+1. The namespaces with even-integer indices are subject namespaces (note that this is a distinct concept from cont-ns>Special:MyLanguage/Manual:$wgContentNamespaces|content namespaces). The subject-talk duality can be explored using the  and   pgnames>Special:MyLanguage/Help:Magic words#Page names|magic words. The  tag of pages in talk namespaces has the " " CSS class, which might be useful for styling.

Built-in namespaces
MediaWiki ships with 18 built-in namespaces:
 * 16 "real" namespaces, corresponding to actual pages, numbered 0 to 15, and grouped in subject/talk pairs
 * 2 "virtual" namespaces (one for dynamically generated special pages, and one serving as an alias for direct file links), numbered -1 and -2, respectively. Since these namespaces don't correspond to pages stored in the database, one cannot create or delete pages in these namespaces, and there are no corresponding discussion namespaces.

The full list is presented in the table below.

Each namespace also has a constant derived from its name, with all letters in uppercase, spaces replaced by underscores, and prefixed by "NS_". For example, the constant for the "User talk" namespace is NS_USER_TALK. A complete list can be found in constants>Special:MyLanguage/Manual:Namespace constants|Manual:Namespace constants.

Custom namespaces
It is possible to define additional namespaces to group additional classes of pages together. This is done using the extra-ns>Special:MyLanguage/Manual:$wgExtraNamespaces|$wgExtraNamespaces</tt> configuration variable.

For a thorough overview, see custom-ns>Manual:Using custom namespaces</>|Using custom namespaces.

Functionality
Some namespaces, like Project and Help, only exist for convenience and do not have any extra functionality compared to the Main namespace.

Template namespace pages can be transclusion>Special:MyLanguage/Help:Transclusion</>|transcluded without namespace prefix.

User namespace pages are associated with user accounts or IP addresses. Changes to user-talkpg>Special:MyLanguage/Help:Talk pages#User talk pages</>|user talk pages generate an automatic message notification.

Pages in sysmsg>Special:MyLanguage/Help:System message</>|"MediaWiki" namespace are used to override default messages in local>Special:MyLanguage/Localisation</>|language file and can only be edited by administrators or other users with the edit-if>Special:MyLanguage/Manual:User rights#editinterface</>|editinterface permission.

File and Category pages have special functionality, as described in <tvar|h-manage></> and <tvar|h-cat></>. Category pages cannot be moved (renamed) yet (but they can be exported and then imported, if you need to maintain edit history). Image moving can be enabled with allow-imgmv>Special:MyLanguage/Manual:$wgAllowImageMoving</>|$wgAllowImageMoving in MediaWiki 1.13 and above.

All pages in discussion namespaces have "post a comment" feature (see Help:Section#Adding a section at the end on Meta).