Movatterモバイル変換


[0]ホーム

URL:


Jump to content
MediaWiki
Search

Manual:Namespace

From mediawiki.org
Translate this page
Languages:

Anamespace is a collection of pages all having a similar purpose. Namespaces can be thought of as partitioning the information within a wiki into different types, keeping "real" content (pages about the main subject matter of the wiki) separate fromuser profiles,help pages, etc.A namespaceprefix is the first part of a page title (if present) indicating which namespace it belongs to. It is separated from the rest of the title by a colon (:). The so-called "main namespace" does not have a prefix.Every namespace has anumber orindex which the MediaWiki software uses to refer to the namespace instead of its name.

Technical overview

Every page on a wiki has a unique title which may begin with a namespace prefix or not. Pages in different namespaces can otherwise share the same name (i.e., not counting their prefixes).

For example, here at MediaWiki.org:

TitleNamespace prefixNamespace numberPage description
API0a page in the "main namespace"
Template:APITemplate10atemplate that can be transcluded into other pages
Manual:APIManual100a page in ourMediaWiki manual (which, in this case, redirects to a different page)

Because the "main namespace" does not have a prefix, any page title having no prefix—or any page whose apparent prefix doesn't match any recognized namespace on the wiki (nor anyinterwiki/interlanguage prefix)—is interpreted as a page in the main namespace.

Note that pages in the main namespace cannot have names starting with any existing namespace prefix followed by a colon, because such pages would be rendered inaccessible by the presence of that namespace.(If this has happened as the result of the creation of a new namespace, thenamespaceDupes.php maintenance script can be used to fix the problem.)

Pages can bemoved between namespaces simply by changing the prefix part of their title.

Namespace prefixes can be translated, and aliases (helpful in shortcuts) can be configured for each (see$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 asearch, and in the page title with the help of the {{DISPLAYTITLE}}magic word.

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

Subject and talk namespaces

SeeHelp:Talk pages for instructions on how to use talk pages.

Most namespaces have an associateddiscussion namespace (or "talk" namespace).All discussion namespaces have odd-integer indices, and the discussion namespace index for a specific namespace with indexn isn+1.The namespaces with even-integer indices aresubject namespaces (note that this is a distinct concept fromcontent namespaces).The subject-talk duality can be explored using the{{SUBJECTPAGENAME}} and{{TALKPAGENAME}}magic words.The‎<body> tag of pages in talk namespaces has thens-talk 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.

IDNamePurposeTalk
0(Main)"Real" content articles[1]Talk1
2UserUser pages[2]User talk3
4ProjectInformation about the wiki[3]Project talk5
6FileMedia description pagesFile talk7
8MediaWikiSite interface customization[4]MediaWiki talk9
10TemplateTemplate pagesTemplate talk11
12HelpHelp pagesHelp talk13
14CategoryCategory description pagesCategory talk15
-1SpecialHolds special pagesN/A
-2MediaAlias for direct links to media files

Each namespace also has a constant derived from its name, with all letters in uppercase, spaces replaced by underscores, and prefixed byNS_.For example, the constant for the "User talk" namespace isNS_USER_TALK.A complete list can be found inExtension default namespaces.


  1. The subject namespace has no prefix.
  2. Editing a User talk page generates a notification for the user.
  3. Defined by$wgMetaNamespace, which unless manually set otherwise, defaults to$wgSitename.
  4. Only editable by users with the 'editinterface' permission.
    Some pages in this namespace additionally requireeditsitecss andeditesitejs permissions.


Custom namespaces

Extensions and site administrators can define additional namespaces to group additional classes of pages together.For a thorough overview, seeManual: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 betranscluded without namespace prefix.

User namespace pages are associated with user accounts or IP addresses. Changes touser talk pages generate an automatic message notification.

Pages in the"MediaWiki" namespace are used to override default messages inlanguage file and can only be edited by administrators or other users with theeditinterface permission.

File and Category pages have special functionality, as described inHelp:Managing files andHelp:Categories.Files can be moved by users with the "movefile" right.Category pages can be moved by users with the "move-categorypages" right.

All pages in discussion namespaces have a "post a comment" feature.

See also

Site administration

Extensions

For extension developers

Retrieved from "https://www.mediawiki.org/w/index.php?title=Manual:Namespace&oldid=7922205"
Category:

[8]ページ先頭

©2009-2025 Movatter.jp