MediaWiki Subpages — Parent-Child Pages, Breadcrumbs, and Automatic Navigation
In this tutorial, you will learn about MediaWiki Subpages. We cover key concepts, practical examples, and best practices to help you master this topic.
Subpages in MediaWiki create parent-child page hierarchies using slash-separated names like Parent/Child, enabling automatic breadcrumb navigation, structured content organization, and template-driven navigation — a pattern widely used on Wikipedia for user sandboxes and documentation subpages.
What You'll Learn
- Creating subpages and understanding the naming convention
- Enabling subpages in different namespaces
- Automatic breadcrumb navigation
- Linking to parent and child pages
- Using subpage templates for navigation
- Organizing documentation with subpage hierarchies
Why It Matters
As your wiki grows, flat lists of pages become unmanageable. Subpages give you a natural hierarchy, like folders on a filesystem. A "DodaBrowser" guide can have subpages for "Installation", "Configuration", and "Troubleshooting" — all grouped under the parent. Automatic breadcrumbs show users where they are, and parent-page links make navigation intuitive. This is how large documentation wikis keep hundreds of pages organized without needing a separate CMS.
Real-World Use
A DodaTech product documentation wiki has this structure:
DodaBrowser/
├── DodaBrowser/Installation
├── DodaBrowser/Configuration
│ ├── DodaBrowser/Configuration/Network
│ └── DodaBrowser/Configuration/Security
├── DodaBrowser/Troubleshooting
└── DodaBrowser/FAQ
Each subpage automatically shows a breadcrumb trail: DodaBrowser > Configuration > Network. The parent page lists all subpages. Navigation templates generate "Previous" and "Next" links automatically.
Learning Path
flowchart LR A["13: Transclusion"] --> B["14: Parser Functions"] B --> C["15: Subpages"] C:::current D["16: Redirects"] E["17: Categories"] F["18: Special Pages"] C --> D --> E --> F classDef current fill#38bdf8,color#0f172a,stroke-width:2px
What Are Subpages?
A subpage is a page whose title contains a slash. The part before the slash is the parent page. The part after is the child.
DodaBrowser Parent page
DodaBrowser/Installation Child/subpage
DodaBrowser/Configuration Child/subpage
DodaBrowser/Configuration/Network Grandchild
The slash creates a hierarchy. You can nest to any depth, though three levels is usually sufficient for most wikis.
Step 1: Enable Subpages
Subpages are not enabled in all namespaces by default. Edit LocalSettings.php:
$wgNamespacesWithSubpages[NS_MAIN] = true;
To enable subpages in multiple namespaces:
$wgNamespacesWithSubpages = [
NS_MAIN => true,
NS_TALK => true,
NS_USER => true,
NS_PROJECT => true,
NS_HELP => true,
];
By default, subpages are enabled in the User, Talk, and Project namespaces but NOT in the main (article) namespace. You must explicitly enable them for main namespace pages.
Step 2: Create a Subpage Structure
Create a parent page first. Go to DodaSync and add some content:
= DodaSync =
'''DodaSync''' is a file synchronization tool developed by DodaTech.
== Documentation ==
* [[DodaSync/Installation|Installation Guide]]
* [[DodaSync/Configuration|Configuration Guide]]
* [[DodaSync/FAQ|Frequently Asked Questions]]
Now create the subpages. Each subpage follows the naming convention Parent/Child:
Title: DodaSync/Installation
Content:
= Installation =
This guide covers installing DodaSync on Windows, macOS, and Linux.
== System Requirements ==
* 1 GB RAM
* 100 MB disk space
* Internet connection
Title: DodaSync/Configuration
Content:
= Configuration =
Learn how to configure DodaSync for your environment.
== Basic Settings ==
* Sync directory
* Sync interval
* File filter
Title: DodaSync/FAQ
Content:
= FAQ =
Common questions about DodaSync.
Step 3: Automatic Breadcrumbs
When subpages are enabled, MediaWiki automatically displays breadcrumb navigation at the top of subpages. For a page called DodaSync/Configuration/Network, the breadcrumb shows:
DodaSync > Configuration > Network
Each part of the breadcrumb is a clickable link to the parent page. The current page is not linked.
Customizing Breadcrumbs with {{SUBJECTPAGENAME}}
Use magic words to reference the parent page:
{{BASEPAGENAME}} Returns "DodaSync/Configuration" for "DodaSync/Configuration/Network"
{{SUBPAGENAME}} Returns "Network" for "DodaSync/Configuration/Network"
{{ROOTPAGENAME}} Returns "DodaSync" for any level of subpage
Breadcrumb Template
Create a custom breadcrumb template at Template:Breadcrumb:
{{#if: {{NAMESPACE}} | {{NAMESPACE}}: |}}[[{{ROOTPAGENAME}}|{{ROOTPAGENAME}}]]
{{#if: {{#titleparts:{{FULLPAGENAME}}|1|2}} | > [[{{#titleparts:{{FULLPAGENAME}}|-1|1}}|{{#titleparts:{{FULLPAGENAME}}|1|2}}]] }}
{{#if: {{#titleparts:{{FULLPAGENAME}}|1|3}} | > [[{{#titleparts:{{FULLPAGENAME}}|-1|2}}|{{#titleparts:{{FULLPAGENAME}}|1|3}}]] }}
> {{SUBPAGENAME}}
Place {{Breadcrumb}} at the top of every subpage for a consistent navigation bar.
Step 4: Subpage Navigation Templates
Create a navigation template that links between sibling subpages:
Create Template:DodaSync Nav:
{| class="wikitable" style="width:100%;text-align:center;"
|-
| [[DodaSync|Overview]] || [[DodaSync/Installation|Installation]] || [[DodaSync/Configuration|Configuration]] || [[DodaSync/FAQ|FAQ]]
|}
Add {{DodaSync Nav}} to the top of all DodaSync-related pages. When you add a new subpage, update one template and all pages get the new link.
Previous/Next Navigation
Create a template that provides Previous and Next links based on the current subpage:
{{#switch: {{SUBPAGENAME}}
| Installation = [[DodaSync|Previous: Overview]] | [[DodaSync/Configuration|Next: Configuration]]
| Configuration = [[DodaSync/Installation|Previous: Installation]] | [[DodaSync/FAQ|Next: FAQ]]
| FAQ = [[DodaSync/Configuration|Previous: Configuration]] | [[DodaSync|Next: Overview]]
}}
This template reads the current subpage name with {{SUBPAGENAME}} and shows appropriate Previous and Next links.
Step 5: Listing Subpages Automatically
MediaWiki's Special:PrefixIndex shows all pages with a given prefix. Go to:
Special:PrefixIndex/DodaSync/
This lists every page whose title starts with "DodaSync/", showing all subpages in a structured list with links.
Subpage List Template
Embed the prefix index directly on the parent page:
{{Special:PrefixIndex/{{BASEPAGENAME}}/}}
Add this to any parent page to automatically list all its subpages. The list updates as you create more subpages.
Step 6: Subpages in the User Namespace
Every user automatically gets subpages in the User namespace:
User:Alice User profile
User:Alice/Sandbox Personal test page
User:Alice/Todo Personal to-do list
User:Alice/Notes/ProjectX Nested notes
Subpages in the User namespace are enabled by default. Users can create personal subpages without affecting the main wiki. This is how Wikipedia users create sandboxes for editing practice.
User Subpage for Drafts
Users can draft articles in their user subpages:
User:Bob/Draft-New-Article
When the draft is ready, move it to the main namespace using the "Move" action.
Step 7: Subpages for Documentation Projects
For a large documentation wiki, use subpages to organize each product:
Product/DodaBrowser
Product/DodaBrowser/Intro
Product/DodaBrowser/Install
Product/DodaBrowser/Config
Product/DodaBrowser/Troubleshoot
Product/DodaSync
Product/DodaSync/Intro
Product/DodaSync/Install
Product/DodaSync/Config
Product/DodaZIP
Product/DodaZIP/Intro
Product/DodaZIP/Install
Each product is a parent page. Each feature or topic is a subpage. The consistent structure makes navigation predictable — users always know that /Install covers installation, regardless of the product.
What You Learned
- Subpages use slash-separated names:
Parent/Child/Grandchild - Enable subpages with
$wgNamespacesWithSubpages - Automatic breadcrumbs show the page hierarchy
{{BASEPAGENAME}},{{SUBPAGENAME}},{{ROOTPAGENAME}}reference page partsSpecial:PrefixIndexlists all subpages- Templates can provide navigation across subpages
- User subpages work for drafts and sandboxes
In the next lesson, you'll learn about redirects — moving pages and managing URL changes.
Common Mistakes
| Mistake | Why It Happens | How to Fix |
|---------|---------------|------------|
| Breadcrumbs do not appear | Subpages not enabled for the namespace | Check $wgNamespacesWithSubpages in LocalSettings.php. The main namespace defaults to false. |
| A slash in the title creates a subpage unintentionally | The page name contains a literal slash | Avoid slashes in page titles unless you intend subpages. Use spaces or hyphens instead. |
| Linking to Parent/Child shows a red link | The subpage has not been created | Create the subpage at the correct path. Alternatively, use [[Parent/Child|link text]] and the link will be red until the page exists. |
| {{BASEPAGENAME}} returns the wrong value | Page is in a namespace | {{BASEPAGENAME}} excludes the namespace prefix. Use {{FULLPAGENAME}} to include the namespace. |
| Subpage navigation template breaks when moved | Hardcoded page paths | Use {{BASEPAGENAME}} and {{SUBPAGENAME}} in navigation templates instead of hardcoding paths. This makes the template portable. |
| Too many subpage levels make URLs long | Deep nesting | Limit subpages to 2-3 levels. Deep nesting creates long URLs that are hard to share and remember. |
Practice Questions
- How do you enable subpages in the main namespace, and why are they disabled by default?
- Create a subpage hierarchy for a "DodaZIP" product with three subpages: "Installation", "Usage", and "Formats Supported".
- What is the difference between
{{BASEPAGENAME}},{{SUBPAGENAME}}, and{{ROOTPAGENAME}}? Give an example for page "DodaSync/Configuration/Network". - Challenge: Build a complete subpage documentation system for a product called "DodaAnalytics". Create the parent page with an overview and a template listing all subpages using
{{Special:PrefixIndex/...}}. Create at least 4 subpages (Installation, Dashboard, Reports, API). Create a navigation template that appears on all subpages with links to all siblings. Add a breadcrumb template that shows the full path. Finally, add Previous/Next navigation between the subpages.
FAQ
Mini Project
Goal: Build a complete product documentation wiki using subpages.
- Create a parent page called "DodaBackup" with a product overview
- Create 5 subpages:
/Installation,/Configuration,/Scheduling,/Restore,/FAQ - Add content to each subpage (at least 2 sections each)
- Create a navigation template
Template:DodaBackup Navwith links to all subpages - Add the template to all 5 subpages and the parent page
- Add a breadcrumb template showing the current location
- Add the
{{Special:PrefixIndex/DodaBackup/}}magic word to the parent page - Verify breadcrumbs appear on all subpages
- Create a user subpage sandbox at
User:YourName/Sandbox
What's Next
Subpages organize your content into hierarchies. But what happens when you need to move or rename pages without breaking links?
Continue to Lesson 16: Redirects — learn how to move pages, create redirects, avoid double redirects, and use soft redirects for external links.
Built by the developers of DodaTech
Doda Browser, DodaZIP & Durga Antivirus Pro