Help:Subpages: Difference between revisions

From Freephile Wiki
Gregbot (talk | contribs)
m Mirror from http://www.mediawiki.org/wiki/Help:Subpages
 
No edit summary
 
Line 1: Line 1:
{{PD Help Page}}
'''Subpages''' introduce some hierarchical organisation into wiki page names, with levels of the hierarchy separated by slashes '/'.
'''Subpages''' introduce some hierarchical organisation into wiki page names, with levels of the hierarchy separated by slashes '/'.


=== Namespaces ===
=== Where it works ===
MediaWiki's '''subpage''' feature is turned '''off by default''' in the main namespace, but can be used on [[Help:Talk pages|talk pages]] and [[Help:User page|user pages]]. See [[Help:namespaces]]. In namespaces where the feature is switched off, any slashes (/) within a page name are simply part of the page name and do nothing special.
MediaWiki's '''subpage''' feature is turned '''off by default''' in the main namespace, but can be used on [[Help:Talk pages|talk pages]] and [[Help:User page|user pages]]. See [[Help:namespaces]]. In namespaces where the feature is switched off, any slashes (/) within a page name are simply part of the page name and do nothing special. '''This wiki allows subpages in the main article namespace'''.


=== Slashes within a page name ===
=== How it works ===
Slashes (/) within a page name break the page into parent and subpages, recursively, eg:
Slashes (/) within a page name break the page into parent and subpages, recursively, eg:


:[[Example page]]
:[[MediaWiki]]
:[[Example page/Some sub-page]]
:[[MediaWiki/Presentation]]
:[[Example page/Some sub-page/Some sub-sub-page]]
:[[MediaWiki/Upgrade/REL1 25 to REL1 26]]


A '''link back to parent''' will automatically appear at the top of each subpage. In the case of sub-sub-pages, a set of breadcrumb navigation links will automatically be presented. Note that these links do not appear, however, if the parent page has not yet been created.
You can link directly to any page’s subpage using the normal ''double square brackets'' notation, by providing the full name – including the slash(es) and the individual subpage name(s). You can also link from one page to one of ''its own'' subpages using certain shortcuts, which are covered at [[Help:Links]].
 
There are Magic words to split the name of a subpage, such as <code><nowiki>{{BASEPAGENAME}}</nowiki></code> and <code><nowiki>{{SUBPAGENAME}}</nowiki></code>, and the parser function <code><nowiki>{{#titleparts:}}</nowiki></code> for finer control.
 
Note that the part of page names after a slash is case sensitive '''including the first letter.'''
 
'''Breadcrumb''' links will appear automatically at the top of the subpage, linking to each parent page that exists. These links do not appear, however, if the parent pages have not yet been created or if the subpage feature is turned off.
 
As these automatic breadcrumb links are not in the page content, the breadcrumbs do not place parent pages in the [[mw:Help:What_links_here|What links here]] and [[mw:Help:Related_changes|Related changes]] lists.
 
If you [[mw:Help:Moving_a_page|move (rename)]] a parent page, you will be shown a list of the subpages, and users with the ''move-subpages'' [[mw:Help:User_rights|user right]] will have the option to automatically move subpages (up to 100).


=== Using (and over-using) sub pages ===
=== Using (and over-using) sub pages ===
There are various uses for the subpage mechanism. The main two intended uses are:
There are various uses for the subpage feature. The main two intended uses are:
* On a [[Help:Talk pages|talk page]] create a subpage (or several) for an archiving of old discussions
* On a [[Help:Talk pages|talk page]] create a subpage (or several) for an archiving of old discussions
* On a [[Help:User page|user page]] create a subpage (or several) to use as a scratchpad editing space.
* On a [[Help:User page|user page]] create a subpage (or several) to use as a scratchpad editing space.


People instinctively think hierarchically when trying to organise information, so it may be tempting to use subpages all the time. However, subpages can be over-used. Remember that having a page name with a slash will generally make the name longer, harder to remember, and thus more difficult to link to. Some people find it more elegant to keep page naming simple. By sticking to a flat naming structure, with a manually maintained web of wiki links, a structure will emerge organically (and this can include a pseudo-hierarchy)
People instinctively think hierarchically when trying to organize information, so it may be tempting to use subpages all the time. However, subpages can be over-used. Remember that having a page name with a slash will generally make the name longer, harder to remember, and thus more difficult to link to. Some people find it more elegant to keep page naming simple. By sticking to a flat naming structure, with a manually maintained web of wiki links, a structure will emerge organically (and this can include a pseudo-hierarchy). You can also organize pages with the [[mw:Help:Category|category]] feature, which is more suitable for creating a hierarchical network of information.
 
{{Admin tip|tip=Subpages can be activated within the 'main' namespace by adding to the [[mw:Manual:$wgNamespacesWithSubpages|$wgNamespacesWithSubpages]] array.}}
 
== Displaying Subpages ==
Subpages can be listed very plainly by transcluding [[Special:PrefixIndex]], like this:
 
<pre>
{{Special:PrefixIndex/{{FULLPAGENAME}}/}}
</pre>
 
=== Using SubPageList ===
This wiki includes the [[mw:Extension:SubPageList|SubPageList]] extension, so you can display subpages as easy as:
<pre>
{{#subpages:}}
</pre>
 
Because the syntax might be more than you want to remember, we created a '''template''' named [[:Template:Subpages|Subpages]] that invokes the parser function and adds a heading above it.
 
{{messagebox|
|type=success
|text=So, the really easy way to display a list of subpages is to just stick <nowiki>{{Template:Subpages}}</nowiki> into your page.}}


{{Admin tip|tip=Subpages can be activated within the 'main' namespace by adding to the {{mediawiki|Manual:$wgNamespacesWithSubpages|$wgNamespacesWithSubpages}} array.}}
=== Other Dynamic Page Listings ===
This wiki includes the [[mw:Extension:DynamicPageList3]] extension. So, if you want to display a list of pages on some '''other''' criteria such as category membership, author, template usage, etc., use that functionality instead.


==See also==
==See also==

Latest revision as of 09:53, 3 September 2025

Subpages introduce some hierarchical organisation into wiki page names, with levels of the hierarchy separated by slashes '/'.

Where it works

MediaWiki's subpage feature is turned off by default in the main namespace, but can be used on talk pages and user pages. See Help:namespaces. In namespaces where the feature is switched off, any slashes (/) within a page name are simply part of the page name and do nothing special. This wiki allows subpages in the main article namespace.

How it works

Slashes (/) within a page name break the page into parent and subpages, recursively, eg:

MediaWiki
MediaWiki/Presentation
MediaWiki/Upgrade/REL1 25 to REL1 26

You can link directly to any page’s subpage using the normal double square brackets notation, by providing the full name – including the slash(es) and the individual subpage name(s). You can also link from one page to one of its own subpages using certain shortcuts, which are covered at Help:Links.

There are Magic words to split the name of a subpage, such as {{BASEPAGENAME}} and {{SUBPAGENAME}}, and the parser function {{#titleparts:}} for finer control.

Note that the part of page names after a slash is case sensitive including the first letter.

Breadcrumb links will appear automatically at the top of the subpage, linking to each parent page that exists. These links do not appear, however, if the parent pages have not yet been created or if the subpage feature is turned off.

As these automatic breadcrumb links are not in the page content, the breadcrumbs do not place parent pages in the What links here and Related changes lists.

If you move (rename) a parent page, you will be shown a list of the subpages, and users with the move-subpages user right will have the option to automatically move subpages (up to 100).

Using (and over-using) sub pages

There are various uses for the subpage feature. The main two intended uses are:

  • On a talk page create a subpage (or several) for an archiving of old discussions
  • On a user page create a subpage (or several) to use as a scratchpad editing space.

People instinctively think hierarchically when trying to organize information, so it may be tempting to use subpages all the time. However, subpages can be over-used. Remember that having a page name with a slash will generally make the name longer, harder to remember, and thus more difficult to link to. Some people find it more elegant to keep page naming simple. By sticking to a flat naming structure, with a manually maintained web of wiki links, a structure will emerge organically (and this can include a pseudo-hierarchy). You can also organize pages with the category feature, which is more suitable for creating a hierarchical network of information.

Tip for wiki admins: Subpages can be activated within the 'main' namespace by adding to the $wgNamespacesWithSubpages array.

Displaying Subpages

Subpages can be listed very plainly by transcluding Special:PrefixIndex, like this:

{{Special:PrefixIndex/{{FULLPAGENAME}}/}}

Using SubPageList

This wiki includes the SubPageList extension, so you can display subpages as easy as:

{{#subpages:}}

Because the syntax might be more than you want to remember, we created a template named Subpages that invokes the parser function and adds a heading above it.

So, the really easy way to display a list of subpages is to just stick {{Template:Subpages}} into your page.


Other Dynamic Page Listings

This wiki includes the mw:Extension:DynamicPageList3 extension. So, if you want to display a list of pages on some other criteria such as category membership, author, template usage, etc., use that functionality instead.

See also

⧼tpt-languages-legend/Subpages⧽ English