Jump to content
MediaWiki

Manual:$wgNamespaceAliases

From mediawiki.org
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:[]
Other settings: Alphabetical | By function

Details

[edit ]

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

Set this to a map from namespace names to IDs (either symbolic or numerical).

Example:

$wgNamespaceAliases = [
	'Wikipedian' => NS_USER,
	'Wikipedian_talk' => NS_USER_TALK,
	'Our_wiki' => 4,
	'Our_wiki_talk' => 5,
];
Caution! Caution: Use underscores instead of spaces when defining namespace alias names. 'My Namespace' is an invalid name; use 'My_Namespace' instead. (When used later on the wiki in links and searches, either spaces or underscores can be used.)
Prior to MediaWiki 1.17, it was impossible to make an alias to NS_MAIN.
Namespace names, including aliases, are case-insensitive. 'Wikipedian', 'wikipedian', and 'WIKIPEDIAN' are all the same alias.

Notice how aliases are being defined here for two namespaces and their corresponding talk namespaces. Including similar aliases for talk namespaces is not strictly necessary, but not doing so can be confusing to users.

To add a single alias, or multiple aliases one at a time, the following syntax can be used:

$wgNamespaceAliases['WP'] = NS_PROJECT;
$wgNamespaceAliases['WPT'] = NS_PROJECT_TALK;
$wgNamespaceAliases['WP_talk'] = NS_PROJECT_TALK;

This illustrates how multiple aliases can be used for the same namespace.

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.

AltStyle によって変換されたページ (->オリジナル) /