Subpages
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.
By default, MediaWiki's subpage feature is turned off in the main namespace, but can be used on talk pages and user pages. See Help:Namespaces for description of namespaces and $wgNamespacesWithSubpages to learn how to modify this default behavior. In namespaces where the feature is switched off, any forward slashes (/) within a page name are simply part of the page name and do nothing special.
When subpages are enabled in a namespace, a forward slash in the title of a page always causes the page to be a subpage. If this is not desired, you can #Bypass subpages using alternative characters.
Source: MediaWiki Help:Subpages
Subpages and NS_Main
Subpages are not permitted in the Main namespace, by default, and not recommended by the MediaWiki developers. The aim is to retain a 'flat' structure.
Here is an example of what is intended to be a subpage, in the Main namespace, with the default settings. Note the absence of 'breadcrumbs'.
To enable subpages in the Main namespace the following line must be added to LocalSettings.php.
# Enable subpages in the main namespace $wgNamespacesWithSubpages[NS_MAIN] = true;
With subpages enabled in the Main namespace the page Colour Scheme is now a subpage of Customising the Skin evidenced by the breadcrumbs produced by MediaWiki to navigate to the parenht page.
As discussed below, it is easy to misuse subpages by using them as a tree structure for sub-topics. However, in the example here Customising the Skin, the content is too large for a single page; the subpages each have the same parent; the content in each subpage is part of the same tutorial; and the scope is limited.
Subpage List
A simple way to display a list of subpages on any 'parent' page is to insert the following:
<h5>Sub-page List</h5> <p>{{Special:PrefixIndex/{{FULLPAGENAME}}/}}</p>
The Help:Subpages describes how parameters can be passed to Special:PrefixIndex. More detail is provided in the article Help:All pages with prefix
The variant that I mostly use (for listing subpages) is:
<h5>Sub-page List</h5> <p>{{Special:PrefixIndex/{{FULLPAGENAME}}/|stripprefix=1}}</p>
Subpages and Transclusion
Within the mh370wiki.net website there are many instances of the parent page content actually transcluded from subpages. This is described in the article Transclusion and Subpages.
Subpages in the Template Namespace
Many of the templates in the mh370wiki.net website are in subpages. The parent page may contain instructions, or the subpages could simply be variants of a template to be used in different contexts. The article Templates and Subpages provides examples.
Subpage Overuse Example
I did enable subpages in NS_Main on the mh370wiki.net website, because the feature is useful, but with the benefit of hindsight over-used subpages. The example below shows a subpage list for a parent page Reports.
The subpages are 'nested' with up to four levels. The top level is simply Reports, and the second-level names such as SAR (Search and Rescue), Search, RMP (Royal Malaysia Police) could be Categories.
When starting out it is perhaps natural to mentally 'organise' content in a MediaWiki website, and subpages permit a tree-like structure that initially works. But Categories are hierarchical; content should be 'flat'.
If all reports in a Search and Rescue category - SAR Reports - are listed (using CategoryTree), ideally what we should see is the name of each relevant report only, without the subpage parents.
A later release of the mh370wiki.net website will be restructured, this problem and others like it will be resolved. The takeaway is, avoid over-use of subpages!
Links
Help:Subpages https://www.mediawiki.org/wiki/Help:Subpages