Jump to content

IC:MW Talk Namespaces

From Costa Sano MediaWiki

Custom Talk Namespaces in MediaWiki

This document explains the purpose of Talk namespaces in MediaWiki, how custom Talk namespaces are defined, and why they only appear in the namespace list after specific configuration steps.

1. Purpose of Talk Namespaces

MediaWiki separates *content* from *discussion* using paired namespaces:

  • Even-numbered namespace → content (e.g. Network)
  • Odd-numbered namespace → talk/discussion (e.g. Network_Talk)

Talk namespaces serve several purposes:

  • Keep content pages clean and factual.
  • Provide a dedicated space for questions, decisions, and editorial notes.
  • Preserve decision history for future maintainers.
  • Support structured workflows (templates, categories, archiving).
  • Allow experimentation and discussion without altering the main content.

Every content namespace should have a corresponding Talk namespace for long-term maintainability.

2. Why MediaWiki Does Not Auto‑Create Talk Namespaces

MediaWiki automatically creates Talk namespaces only for its built‑in namespaces (Main, File, Help, etc.).

For custom namespaces, MediaWiki does *not* assume a Talk namespace exists. It will only register a Talk namespace when:

  1. A numeric ID is defined.
  2. A name is assigned in $wgExtraNamespaces.
  3. The ID is an odd number paired with the content namespace.

Until these conditions are met, the Talk namespace will not appear in:

  • Special:SpecialPages → “Namespaces”
  • Special:AllPages namespace dropdown
  • API namespace lists

3. Defining a Custom Namespace Pair

A correct custom namespace definition looks like this:

# --- Custom namespace: Network ---
define("NS_NETWORK", 3000);
define("NS_NETWORK_TALK", 3001);

$wgExtraNamespaces[NS_NETWORK] = "Network";
$wgExtraNamespaces[NS_NETWORK_TALK] = "Network_Talk";

# Optional: namespace shortcuts
$wgNamespaceAliases['N'] = NS_NETWORK;
$wgNamespaceAliases['N_Talk'] = NS_NETWORK_TALK;

# Optional: enable subpages
$wgNamespaceWithSubpage[NS_NETWORK] = true;

Required elements

  • define("NS_NETWORK", 3000);
  • define("NS_NETWORK_TALK", 3001);
  • $wgExtraNamespaces[...] entries for both
  • namespace aliases
  • subpage support

4. Why the Talk Namespace Appears Only After Full Definition

MediaWiki registers namespaces early during startup. A Talk namespace will only appear when:

  • Both the content and talk IDs are defined.
  • Both names are assigned in $wgExtraNamespaces.
  • The definitions are placed early enough in LocalSettings.php.

If the Talk namespace is defined later in the file, or after extensions that query namespaces, it may not appear until the next reload.

Rule of thumb

Place all custom namespace definitions **at the top of LocalSettings.php**, before loading extensions.

5. Namespace ID Pairing (Even/Odd Rule)

MediaWiki uses numeric pairing to link content and talk namespaces:

  • Even ID → content namespace
  • Odd ID → talk namespace
  • The talk namespace must immediately follow the content namespace

Example:

  • 3000 → Network
  • 3001 → Network_Talk

If the pairing is broken, MediaWiki will not recognize the Talk namespace correctly.

6. Summary

  • Talk namespaces store discussion, decisions, and editorial notes separate from content.
  • MediaWiki does not auto-create Talk namespaces for custom namespaces.
  • A Talk namespace appears only after proper definition (ID + name + pairing).
  • Namespace definitions must be placed early in LocalSettings.php.
  • Even/odd numeric pairing is essential for correct behavior.

This structure ensures clean content pages, clear editorial history, and a successor‑friendly wiki architecture.