Subpages

From Meta

Jump to: navigation, search
 
This page should be moved to MediaWiki.org.
Please do not move the page by hand. It will be imported by a MediaWiki.org administrator with the full edit history. In the meantime, you may continue to edit the page as normal.

You can create sub pages, that will automatically have a link back to the container page.

to create a page that is highly related to the parent page, and contains a link back to the parent page automatically.

Contents

[edit] Use

They are primarily used for archiving old talk pages, and documents for non-current versions

[edit] Deprecated use

but could be used for redirection (but categories handle this more naturally)

 History/United Kingdom  could point to History of United Kingdom
 United Kingdom/History could also point to History of United Kingdom.


sub pages are not used in the main namespace, because...? (see Wikipedia:Subpages )

[edit] Restrictions

  • Sub pages are enabled for the User namespace by default, but not the main namespace (see below)
  • The entire "Top_Page/subpage/other_subpage" string can't be more than 255 characters, including the slashes.

[edit] How to do it

  • Just put a "/" as the first character of your /wikilink, and it will be equivalent to:

Sub pages/wikilink

  • Note that if you don't have subpages enabled for that namespace, you'll create a top-level page whose name begins with '/'.

See Help:Link#Subpage feature.

[edit] Administration

sub pages must be enabled for the namespace!

[edit] Enabling in main name space

An easy way to enable subpages in the main namespace is to edit your LocalSettings.php and insert the following:

# Enable subpages in the main namespace
$wgNamespacesWithSubpages[NS_MAIN] = true;

This overrides the DefaultSettings.php setting for namespace 0. In this manner you can override any single namespace without overriding more than you need to.

[edit] Enabling for all namespaces

# Enable subpages in all namespaces
$wgNamespacesWithSubpages = array_fill(0, 200, true);

[edit] Namespace names

The names for namespaces are set in files such as those listed in m:Locales for the Wikimedia projects, with default m:Language.php:

/* private */ $wgNamespaceNamesEn = array(
        NS_MEDIA            => 'Media',
        NS_SPECIAL          => 'Special',
        NS_MAIN             => '',
        NS_TALK             => 'Talk',
        NS_USER             => 'User',
        NS_USER_TALK        => 'User_talk',
        NS_WIKIPEDIA        => $wgMetaNamespace,
        NS_WIKIPEDIA_TALK   => $wgMetaNamespace . '_talk',
        NS_IMAGE            => 'Image',
        NS_IMAGE_TALK       => 'Image_talk',
        NS_MEDIAWIKI        => 'MediaWiki',
        NS_MEDIAWIKI_TALK   => 'MediaWiki_talk',
        NS_TEMPLATE         => 'Template',
        NS_TEMPLATE_TALK    => 'Template_talk',
        NS_HELP             => 'Help',
        NS_HELP_TALK        => 'Help_talk',
        NS_CATEGORY         => 'Category',
        NS_CATEGORY_TALK    => 'Category_talk'
);
Personal tools