Transclusion and 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.
Subpages and Namespaces
Although the concept of transcluding content from a subpage into a parent page sounds useful, by default MediaWiki does not allow subpages in the Main Namespace.
To enable subpages in both the Main and Template namespaces the following lines must be added to LocalSettings.php.
# Enable subpages in the main namespace $wgNamespacesWithSubpages[NS_MAIN] = true; # Enable subpages in the template namespace $wgNamespacesWithSubpages[NS_TEMPLATE] = true;
In the mh370wiki.net website I have enabled the use of subpages in most of the custom namespaces and describe transclusion between namespaces in this article Namespaces.
I also use subpages in the Template namespace and describe the purpose in this article Templates.
Below is the description of transclusion used with subpages on the mh370wiki.net website.
Transclusion and Subpages example from mh370wiki.net
The Safety Investigation Report for Malaysia Airlines Flight MH370 released in 2018 is a substantial document and I have included some sections in the mh370wiki.net for reference purposes.
I basically 'deconstructed' this report into small sections. As an example, the Findings from the official Investigation is on this page: SIR 2018:3 Findings and Conclusion/3.1 Findings.
Each numbered section, however, is on a sub-page.
The Findings page actually looks like this:-
<noinclude>{{SIR2018/Header}}</noinclude>
<h4 style="margin-left:30px;">3.1 Findings</h4>
{{SIR 2018:3 Findings and Conclusion/3.1 Findings/3.1.1}}
{{SIR 2018:3 Findings and Conclusion/3.1 Findings/3.1.2}}
{{SIR 2018:3 Findings and Conclusion/3.1 Findings/3.1.3}}
{{SIR 2018:3 Findings and Conclusion/3.1 Findings/3.1.4}}
{{SIR 2018:3 Findings and Conclusion/3.1 Findings/3.1.5}}
{{SIR 2018:3 Findings and Conclusion/3.1 Findings/3.1.6}}
{{SIR 2018:3 Findings and Conclusion/3.1 Findings/3.1.7}}
{{SIR 2018:3 Findings and Conclusion/3.1 Findings/3.1.8}}
<noinclude>{{SIR2018/Footer}}</noinclude>
Each subpage has both a header and a footer but these are not included when the page is transcluded.
Also, each transcluded section contains a link to itself, so on the page 3.1 Findings, each section number is actually a link. 3.1.1 links to the sub-page SIR 2018:3 Findings and Conclusion/3.1 Findings/3.1.1, for example.
I find that useful because if a section does not display correctly I can open that section easily instead of manually typing the full subpage name in the Search box.
In the subpage, the heading including the link looks like this:-
<p><b>[[SIR_2018:3_Findings_and_Conclusion/3.1_Findings/3.1.1|3.1.1]] Diversion from Filed Flight Plan Route</b></p>