Knowledgebase

Reference list of MediaWiki namespaces with ID numbers and constants

All the pages in MediaWiki are organized and grouped into namespaces. For example, the regular pages, meaning the articles/content pages created by users, belong to the Main namespace. The application comes preconfigured with some namespaces, but it's also possible to create custom ones. Each namespace has an ID number with which it's defined and also a constant. The index numbers and constants are defined in the file Defines.php; the file is in the includes folder which in its turn is in the root MediaWiki directory on your MediaWiki hosting account. The constant consists of NS_ followed by one or more words (in uppercase letters), all separated with underscores. The numbers corresponding to namespaces (or their constants) are used when you edit or change some options related to namespaces in the LocalSettings,php file, for example.

Here's a reference list of the index numbers of the different namespaces. In brackets after the number we've also included the constant with which the namespaces is identified.

0 (NS_MAIN) - Main; that's the namespaces for the articles.

1 (NS_TALK) - Talk; the namespace for the discussion pages associated with the pages from the Main namespace

2 (NS_USER) - User; the namespace for the personal pages of users.

3 (NS_USER_TALK) - User talk; the discussion pages associated with user pages.

4 (NS_PROJECT) - Project; this namespace is intended for pages about the site (e.g. About us, Disclaimer, Policy, etc.).

5 (NS_PROJECT_TALK) - Project talk; the namespace for discussion pages related to the pages of the Project namespace.

6 (NS_FILE) - File; the namespace for uploaded media files. Each uploaded file automatically has a page created in the File namespace that displays the file (e.g. an image) and some information about it.

7 (NS_FILE_TALK) - File talk; discussion pages associated with pages in the File namespace.

8 (NS_MEDIAWIKI) - MediaWiki; this namespace contains pages with which various aspects of the site can be modified. For instance, the pages for editing system/interface messages, for modifying the CSS code of skins, etc.

9 (NS_MEDIAWIKI_TALK) - MediaWiki talk; the namespace for the talk pages on which can be discussed the associated pages of the MediaWiki namespace.

10 (NS_TEMPLATE) - Template; the namespace for templates. Templates are used for including standard text messages on pages without the need to type the whole message each time.

11 (NS_TEMPLATE_TALK) - Template talk; the discussion pages for templates.

12 (NS_HELP) - Help; this is a namespace intended for pages with instructions, helpful information.

13 (NS_HELP_TALK) - Help talk; in this namespace are stored the discussion pages associated with the pages of the Help namespace.

14 (NS_CATEGORY) - Category; the namespace for category pages. Categories are used to group other pages with something similar in their content. A category page is a list of the pages that belong to the category.

15 (NS_CATEGORY_TALK) - Category talk; the talk pages for discussing categories.

-1 (NS_SPECIAL) - Special; the namespace for all the special pages that provide tools, statistics and information about the site. Unlike the other namespaces, users cannot add and edit the pages in this namespace.

-2 (NS_MEDIA) - Media; this namespace is used for providing direct links to media files. It doesn't consist of pages created by users.

In MediaWiki versions older than 1.14 the constants for the File and File talk namespaces are respectively NS_IMAGE and NS_IMAGE_TALK. In newer versions these constants are still kept for compatibility reasons.

Was this answer helpful?

 Print this Article

Also Read