[go: nahoru, domu]

Jump to content

Manual:$wgNamespaceAliases: Difference between revisions

From mediawiki.org
Content deleted Content added
No edit summary
Tags: Reverted Visual edit Mobile edit Mobile web edit
m Reverted edits by 1.47.23.9 (talk) to last version by Kghbln
Tag: Rollback
 
Line 1: Line 1:
၀634၇9၈44<languages/>
<languages/>
{{SettingSummary
{{SettingSummary
|name=NamespaceAliases
|name=NamespaceAliases

Latest revision as of 03:40, 21 April 2024

Namespaces: $wgNamespaceAliases
Provide additional names for namespaces.
Introduced in version:1.10.0 (r21720)
Removed in version:still in use
Allowed values:(array of strings)
Default value:[]

Details[edit]

These are alternate names for the primary localized namespace names, which are defined by $wgExtraNamespaces and the language file. If a page is requested with such a prefix, the request will be redirected to the primary name.

Set this to a map from namespace names to IDs. Example:

$wgNamespaceAliases = [
	'Wikipedian' => NS_USER,
	'Help' => 100
];

To add a single alias:

$wgNamespaceAliases['WP'] = NS_PROJECT;

If you need an alias for the project you probably need a similar alias for its talk page and you should add an array as above or two lines:

$wgNamespaceAliases['WP'] = NS_PROJECT;
$wgNamespaceAliases['WP_talk'] = NS_PROJECT_TALK;
Prior to MediaWiki 1.17, it was impossible to make an alias to NS_MAIN.

If this setting is set to a namespace that does not exist (e.g. the namespace has not been added to $wgExtraNamespaces but a constant has been defined) the alias will redirect to the main space.

Do not use spaces[edit]

Use underscores instead of spaces in namespace names. 'My Namespace' is an invalid name; use 'My_Namespace' instead.