Configure Namespaces

From mw.mh370.wiki
Jump to navigation Jump to search


A Guide to Using MediaWiki in a Hosted Environment

An instructional website by the developer of mh370wiki.net - a MediaWiki site about Malaysia Airlines Flight MH370.


Namespaces are configured in LocalSettings.php.

20 July 2025 - I have added three namespaces to this website. The configuration in LocalSettings.php follows:-

# Custom Namespaces
## Numbers from 3000 to 4999 are reserved for system administrators to define their custom namespaces. 
# Draft
define("NS_DRAFT", 3100);
$wgContentNamespaces[] = 3100;
$wgExtraNamespaces[NS_DRAFT] = "Draft";
$wgNamespaceProtection[NS_DRAFT] = array( 'editDRAFT' );
$wgGroupPermissions['sysop']['editDRAFT'] = true;
$wgNamespacesWithSubpages[NS_DRAFT] = true;
$wgNamespaceAliases['Draft'] = NS_DRAFT;
# TALK NOT REQUIRED
## define("NS_DRAFT_TALK", 3101);
## $wgExtraNamespaces[NS_DRAFT_TALK] = "Draft_talk";
## $wgNamespacesWithSubpages[NS_DRAFT_TALK] = true;
## $wgNamespaceAliases['Draft_TALK'] = NS_DRAFT_TALK;

# Snippets
define("NS_SNIPPETS", 3400);
$wgContentNamespaces[] = 3400;
$wgExtraNamespaces[NS_SNIPPETS] = "Snippets";
$wgNamespaceProtection[NS_SNIPPETS] = array( 'editSNIPPETS' );
$wgGroupPermissions['sysop']['editSNIPPETS'] = true;
$wgNamespacesWithSubpages[NS_SNIPPETS] = true;
$wgNamespaceAliases['Snippets'] = NS_SNIPPETS;
# TALK NOT REQUIRED
## define("NS_SNIPPETS_TALK", 3401);
## $wgExtraNamespaces[NS_SNIPPETS_TALK] = "Snippets_talk";
## $wgNamespacesWithSubpages[NS_SNIPPETS_TALK] = true;
## $wgNamespaceAliases['Snippets_TALK'] = NS_SNIPPETS_TALK;

# Tooltips
define("NS_TOOLTIPS", 3500);
$wgContentNamespaces[] = 3500;
$wgExtraNamespaces[NS_TOOLTIPS] = "Tooltips";
$wgNamespaceProtection[NS_TOOLTIPS] = array( 'editTOOLTIPS' );
$wgGroupPermissions['sysop']['editTOOLTIPS'] = true;
$wgNamespacesWithSubpages[NS_TOOLTIPS] = true;
$wgNamespaceAliases['Tooltips'] = NS_TOOLTIPS;
# TALK NOT REQUIRED
## define("NS_TOOLTIPS_TALK", 3501);
## $wgExtraNamespaces[NS_TOOLTIPS_TALK] = "Tooltips_talk";
## $wgNamespacesWithSubpages[NS_TOOLTIPS_TALK] = true;
## $wgNamespaceAliases['Tooltips_TALK'] = NS_TOOLTIPS_TALK;
Note: See also Namespace Permissions and the Extension Lockdown, used to control access to content namespaces.


Purpose

In every MediaWiki website I have created a custom namespace for 'work in progress', ideas, and draft content.

The mh370wiki.net website has hundreds of 'tooltips' which are displayed by the extension Lingo. To separate pages containing tooltips from content in the Main namespace I have used a custom namespace. Lingo only looks for one page containing tooltips, so a separate namespace would be excessive for most sites, including this one. The glossary in mh370wiki.net is held in separate pages for each alphabet letter, transcluded into the Tooltips page used by Lingo.

The Snippets namespace is a new idea for this website but based on a concept I developed for mh370wiki.net. Reusable content stored in a custom namespace can be transcluded into many articles in the main namespace, but an update requires only a single edit.

The Talk namespaces associated with each of the above content namespaces is not required, so I simply commented the relevant lines. They could be deleted, but commenting enables the Talk namespaces to be enabled easily.

Namespace Numbering and Sort Order

As noted in a Comment, Numbers from 3000 to 4999 are reserved for system administrators to define their custom namespaces..

The convention is to use an even number for a custom namespace, and an odd number for the associated Talk namespace.

To view the Namespace listing open Tools --> Special pages --> All pages, and select the dropdown under the heading Namespace:

The custom namespaces created by the settings above are listed in numeric order below the standard namespaces:-

To achieve an alphabetic list of custom namespaces, order the namespaces numerically when they are defined. Leave gaps in the numbering so other namespaces can be 'inserted' into the sequence.