Ohje:Nimiavaruus
Nimiavaruus on kokoelma sivuja, joiden sisällöllä on samankaltainen tarkoitus. Nimiavaruuksien voidaan ajatella erottelevan eri tyyppiset tiedot samassa wikissä ja pitävän "oikean" sisällön erillään käyttäjäsivuista, ohjesivuista ja muista vastaavista.
The namespace prefix of a page forms part of the title of a page, separated with a colon (:
).
Technical overview
As said, 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 (:
).
Esimerkiksi:
Otsikko | Nimiavaruus | Koodi |
---|---|---|
Foo |
Main | 0 |
Template:Foo |
Template | 10 |
Module:Foo |
Module | 828 |
"Pääavaruudella" ei ole etuliitettä. Pääavaruudessa olevien sivujen nimet eivät voi myöskään alkaa minkään olemassaolevan nimiavaruuden etuliitteellä ja kaksoispisteellä.
Sivuja voi siirtää nimiavaruuksien välillä yksinkertaisesti vaihtamalla niiden otsikossa olevaa etuliitettä.
Namespace prefixes can be translated, and aliases 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 a search, and in the page title with the help of the {{DISPLAYTITLE}} 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 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 content namespaces).
The subject-talk duality can be explored using the {{SUBJECTPAGENAME}}
and {{TALKPAGENAME}}
magic words.
The <body>
tag of pages in talk namespaces has the ns-talk
CSS class, which might be useful for styling.
Sisäänrakennetut nimiavaruudet
MediaWikissä on valmiina 18 sisäänrakennettua nimiavaruutta:
- 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.
ID | Nimi | Tarkoitus | Keskustelu | |
---|---|---|---|---|
0 | (Main) | "Oikeat" sisältösivut .[1] | Talk | 1 |
2 | User | Käyttäjäsivut .[2] | User talk | 3 |
4 | Project | Information about the wiki.[3] | Project talk | 5 |
6 | File | Media description pages | File talk | 7 |
8 | MediaWiki | Site interface customization[4] | MediaWiki talk | 9 |
10 | Template | Mallinesivut | Template talk | 11 |
12 | Help | Ohjesivut | Help talk | 13 |
14 | Category | Category description pages | Category talk | 15 |
-1 | Special | Holds special pages | N/A | |
-2 | Media | Alias 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 by NS_
.
For example, the constant for the "User talk" namespace is NS_USER_TALK
.
A complete list can be found in Manual:Namespace constants .
- ↑ Nimiavaruudella ei ole etuliitettä.
- ↑ Käyttäjän keskustelusivun muokkaaminen lähettää ilmoituksen käyttäjälle.
- ↑ Defined by
$wgMetaNamespace
, which unless manually set otherwise, defaults to$wgSitename
. - ↑ Vain käyttäjät, joilla on 'editinterface'-oikeus, voivat muokata.Some pages in this namespace additionally require
editsitecss
andeditesitejs
permissions.
Custom namespaces
Extensions and site administrators can define additional namespaces to group additional classes of pages together. For a thorough overview, see Manual: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 transcluded without namespace prefix.
User namespace pages are associated with user accounts or IP addresses. Changes to user talk pages generate an automatic message notification.
Pages in the "MediaWiki" namespace are used to override default messages in language file and can only be edited by administrators or other users with the editinterface permission.
Tiedosto- ja luokka-sivuilla on erityisiä toimintoja, kuten Help:Managing files/fi ja Ohje:Luokat . "movefile" -oikeudella olevat käyttäjät voivat siirtää tiedostoja. "move-categorypages" -oikeudella olevat käyttäjät voivat siirtää sivuja.
All pages in discussion namespaces have a "post a comment" feature.
See also
- Help:Namespaces – user-oriented information.
Site administration
Extensions
- Category:Namespace extensions
- Extension:NamespaceManager – for management of namespaces.
- Extension:BlueSpiceNamespaceManager – lets you create custom namespaces.
- Extension:SpecialNamespaces – a modified version of the Extension:Interwiki which changes it to provide a namespace manager as a special page.
- Laajennus:Lockdown – to control access to namespaces.
- Extension:SkinPerNamespace – to use a different skin in a namespace.
For extension developers
- Manual:Using custom namespaces#In_extensions
- List of custom namespaces registered by extensions . If you define a constant for a custom namespace, list it here, too.
- Classes
- Manual:MWNamespace.php , containing the MWNamespace class (poistettu versiossa 1.39)
- Hooks
- Manual:Hooks/CanonicalNamespaces – add custom namespaces or alter the defaults.
- Manual:Hooks/NamespaceIsMovable – determine if it is possible to move pages in a namespace.
- Manual:Hooks/SearchableNamespaces – modify which namespaces are searchable.
- Manual:Hooks/LanguageGetNamespaces – provide custom ordering for namespaces or remove namespaces.
- Manual:Hooks/PrefixSearchExtractNamespace – called if core was not able to extract a namespace from the search string so that extensions can attempt it.