Help:Subpages: Difference between revisions

From Campaigns
Jump to navigation Jump to search
m 1 revision imported
mNo edit summary
 
Line 1: Line 1:
<languages/>
{{PD Help Page}}
{{PD Help Page}}
<translate>
'''Subpages''' introduce some hierarchical organization into wiki pages, with levels of the hierarchy separated by slashes (<code>/</code>).
<!--T:1-->
'''Subpages''' introduce some hierarchical organization into wiki pages, with levels of the hierarchy separated by slashes (<tvar|slash><code>/</code></>).


== Where it works == <!--T:2-->
== Where it works ==
</translate>
By default, MediaWiki's subpage feature is turned off in the main namespace, but can be used on [[mw:Help:Talk pages|talk pages]] and [[mw:Help:User page|user pages]].
<translate><!--T:3--> By default, MediaWiki's subpage feature is turned off in the main namespace, but can be used on [[<tvar|help-talkpages>Special:MyLanguage/Help:Talk pages</>|talk pages]] and [[<tvar|help-userpages>Special:MyLanguage/Help:User page</>|user pages]].</translate>
See [[mw:Help:Namespaces|Help:Namespaces]] for description of namespaces and [[mw:Manual:$wgNamespacesWithSubpages#Enabling-for-a-namespace|$wgNamespacesWithSubpages]] to learn how to modify this default behavior.
<translate><!--T:35--> See <tvar|1>{{ll|Help:Namespaces}}</> for description of namespaces and <tvar|man-wg-ns-with-sp>[[Special:MyLanguage/Manual:$wgNamespacesWithSubpages#Enabling-for-a-namespace|$wgNamespacesWithSubpages]]</> to learn how to modify this default behavior.</translate>
In namespaces where the feature is switched off, any forward slashes (<code>/</code>) within a page name are simply part of the page name and do nothing special.
<translate><!--T:36--> In namespaces where the feature is switched off, any forward slashes (<tvar|slash2><code>/</code></>) within a page name are simply part of the page name and do nothing special.</translate>


<translate>
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|#Bypass subpages using alternative characters]].
<!--T:23-->
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 [[<tvar|1>#Bypass subpages using alternative characters</>|#Bypass subpages using alternative characters]].


== How it works == <!--T:8-->
== How it works ==
 
<!--T:9-->
Slashes (/) within a page name break the page into parent and subpages, recursively, e.g.:
Slashes (/) within a page name break the page into parent and subpages, recursively, e.g.:


<!--T:10-->
* [[Help:Subpages]] – this page
* [[Help:Subpages]] – this page
* [[Help:Subpages/subpage]] – child page
* [[Help:Subpages/subpage]] – child page
Line 26: Line 17:
* [[Help:Subpages/subpage/sub-subpage/sub-sub-subpage]] – great grandchild page
* [[Help:Subpages/subpage/sub-subpage/sub-sub-subpage]] – great grandchild page
* [[Help:Subpages/subpage/sub-subpage/sub-sub-subpage/sub-sub-sub-subpage]] – great great grandchild page
* [[Help:Subpages/subpage/sub-subpage/sub-sub-subpage/sub-sub-sub-subpage]] – great great grandchild page
</translate>


<translate><!--T:11--> 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).</translate>
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).
<translate><!--T:37--> You can also link from one page to one of ''its own'' subpages using certain shortcuts, which are covered at [[<tvar|1>Special:MyLanguage/Help:Links#Internal</>|Help:Links]].</translate>
You can also link from one page to one of ''its own'' subpages using certain shortcuts, which are covered at [[mw:Help:Links#Internal|Help:Links]].


<translate>
There are [[mw:Help:Magic words#Page names|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>{{</nowiki>[[mw:Help:Extension:ParserFunctions#.23titleparts|#titleparts:]]<nowiki>}}</nowiki></code> for finer control.
<!--T:24-->
There are [[Help:Magic words#Page names|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>{{</nowiki>[[Special:MyLanguage/Help:Extension:ParserFunctions#.23titleparts|#titleparts:]]<nowiki>}}</nowiki></code> for finer control.


<!--T:12-->
Note that the part of page names after a slash is case sensitive '''including the first letter.'''
Note that the part of page names after a slash is case sensitive '''including the first letter.'''


<!--T:13-->
[[w:Breadcrumb links|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.
[[w:Breadcrumb links|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.


<!--T:25-->
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 [[Help:Related changes|Related changes]] lists.
As these automatic breadcrumb links are not in the page content, the breadcrumbs do not place parent pages in the [[Help:What links here|What links here]] and [[Help:Related changes|Related changes]] lists.


<!--T:30-->
If you [[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).
If you [[Help:Moving a page|move (rename)]] a parent page, you will be shown a list of the subpages, and users with the ''move-subpages'' [[<tvar|rights>Special:MyLanguage/Help:User rights</>|user right]] will have the option to automatically move subpages (up to 100).


== Use of subpages == <!--T:14-->
== Use of subpages ==
 
<!--T:15-->
There are various uses for the subpage feature. Some of the typical usages of subpages are:
There are various uses for the subpage feature. Some of the typical usages of subpages are:
* to create archives of old discussions under a [[<tvar|help-talkpages2>Special:MyLanguage/Help:Talk pages</>|talk page]]
* to create archives of old discussions under a [[mw:Help:Talk pages|talk page]]
* to create scratchpad editing spaces under a [[<tvar|help-userpages2>Special:MyLanguage/Help:User page</>|user page]]
* to create scratchpad editing spaces under a [[mw:Help:User page|user page]]
* to create other-language versions of a document in multilingual wikis</translate>
* to create other-language versions of a document in multilingual wikis
<translate>
<!--T:28-->
* to create a template's subpages for its documentation, for its code sandbox, for its testcases, and for any subtemplate code
* to create a template's subpages for its documentation, for its code sandbox, for its testcases, and for any subtemplate code
</translate>
<translate><!--T:16--> Subpages are useful for organising information hierarchically.</translate>
<translate><!--T:38--> On the other hand, subpages tend to have a long name that is hard to remember, so it may be more user-friendly to use them as little as possible.</translate>
<translate><!--T:39--> You can also organize pages with the [[<tvar|help-cat>Special:MyLanguage/Help:Category</>|category]] feature, which is more suitable for creating a hierarchical network of information.</translate>


<translate>
Subpages are useful for organising information hierarchically.
== Displaying subpages == <!--T:17-->
On the other hand, subpages tend to have a long name that is hard to remember, so it may be more user-friendly to use them as little as possible.
You can also organize pages with the [[Help:Category|category]] feature, which is more suitable for creating a hierarchical network of information.


<!--T:18-->
== Displaying subpages ==
Subpages can be listed very plainly by transcluding [[Special:PrefixIndex]], like this:
Subpages can be listed very plainly by transcluding [[Special:PrefixIndex]], like this:
</translate>


<pre>
<pre>
Line 74: Line 49:
</pre>
</pre>


<translate>
<!--T:19-->
Which produces this:
Which produces this:
</translate>


{{Special:PrefixIndex/Help:Subpages/}}
{{Special:PrefixIndex/Help:Subpages/}}


<translate><!--T:20--> Since the [[<tvar|help-magicwords>Special:MyLanguage/Help:Magic words</>|magic word]] <tvar|fullpagename><code><nowiki>{{FULLPAGENAME}}</nowiki></code></> outputs the current page, the general wiki markup to show all subpages of the current page is <tvar|all-subpages><code><nowiki>{{Special:PrefixIndex/{{FULLPAGENAME}}/}}</nowiki></code></>.</translate>
Since the [[mw:Help:Magic words|magic word]] <code><nowiki>{{FULLPAGENAME}}</nowiki></code> outputs the current page, the general wiki markup to show all subpages of the current page is <code><nowiki>{{Special:PrefixIndex/{{FULLPAGENAME}}/}}</nowiki></code>.
<translate><!--T:26--> You can pass parameters to this, e.g. <code><nowiki>{{Special:PrefixIndex/{{FULLPAGENAME}}/ |hideredirects=1 |stripprefix=1}}</nowiki></code></translate>
You can pass parameters to this, e.g. <code><nowiki>{{Special:PrefixIndex/{{FULLPAGENAME}}/ |hideredirects=1 |stripprefix=1}}</nowiki></code>


<translate>
The [[mw:Category:Subpage extensions|subpage extensions]], such as [[mw:Extension:SubPageList]], let you customize the display of subpages.
<!--T:27-->
The [[<tvar|1>Special:MyLanguage/Category:Subpage extensions</>|subpage extensions]], such as <tvar|2>{{ll|Extension:SubPageList}}</>, let you customize the display of subpages.
</translate>


{{anchor|Bypass subpages using alternative characters}}
{{anchor|Bypass subpages using alternative characters}}
<translate>
== Bypass subpages using alternative characters ==
== Bypass subpages using alternative characters == <!--T:32-->
As a consequence of the forward slash being a reserved character when subpages are enabled, an alternative character might be needed.
</translate>
Back slashes (<code>\</code>) are treated as normal characters in subpage naming and can be used in place of forward slashes.
<translate><!--T:4--> As a consequence of the forward slash being a reserved character when subpages are enabled, an alternative character might be needed.</translate>
Additionally, as a crude hack, a character similar to the forward slash can be used instead, such as the "[[wikt:⧸|big solidus]]" (U+29F8), which results in Foo⧸bar (cf. a real slash: Foo/bar), or the [[wikt:⁄|solidus]] (U+2044), which results in Foo⁄bar.
<translate><!--T:40--> Back slashes (<tvar|backslash><code>\</code></>) are treated as normal characters in subpage naming and can be used in place of forward slashes.</translate>
Three possible technical disadvantages (apart from the visual difference from a real slash) arise from this hack:
<translate><!--T:41--> Additionally, as a crude hack, a character similar to the forward slash can be used instead, such as the "[[wikt:⧸|big solidus]]" (<tvar|u1>U+29F8</>), which results in Foo⧸bar (cf. a real slash: Foo/bar), or the [[wikt:⁄|solidus]] (<tvar|u2>U+2044</>), which results in Foo⁄bar.</translate>
<translate><!--T:42--> Three possible technical disadvantages (apart from the visual difference from a real slash) arise from this hack:</translate>


# <translate><!--T:5--> People without the necessary fonts won’t be able to view the character properly;</translate>
# People without the necessary fonts won’t be able to view the character properly;
# <translate><!--T:6--> Redirects from the title with a slash must be created, so that linking and search will work correctly.</translate>
# Redirects from the title with a slash must be created, so that linking and search will work correctly.
# <translate><!--T:7--> Both the [[<tvar|man-ns>Special:MyLanguage/Manual:Namespace#Subject-and-talk</>|subject and talk versions]] of a page (and their corresponding subpages, e.g. discussion archives) need to use the hack, so that moving a page would take all connected pages to the new title (if that setting is selected during the move).</translate> <translate><!--T:43--> For example, subpages are disabled in the main namespace in Wikipedia, so while the talk page won't work unless the solidus character is used to prevent having them marked as subpages, the corresponding page in the main namespace could accidentally keep an actual slash.</translate> <translate><!--T:29--> The risk is that the visual similarity might make this go unnoticed by human editors.</translate>
# Both the [[mw:Manual:Namespace#Subject-and-talk|subject and talk versions]] of a page (and their corresponding subpages, e.g. discussion archives) need to use the hack, so that moving a page would take all connected pages to the new title (if that setting is selected during the move). For example, subpages are disabled in the main namespace in Wikipedia, so while the talk page won't work unless the solidus character is used to prevent having them marked as subpages, the corresponding page in the main namespace could accidentally keep an actual slash. The risk is that the visual similarity might make this go unnoticed by human editors.


<translate>
== See also ==
== See also == <!--T:21-->
* [[mw:Manual:$wgNamespacesWithSubpages]]
</translate>
* [[m:Help:Link#Subpage feature|m:Help:Link#Subpage feature]]
* {{ll|Manual:$wgNamespacesWithSubpages}}
* [[mw:Help:Variables#Page-names]]
* [[m:Special:MyLanguage/Help:Link#Subpage feature|<translate><!--T:33--> m:Help:Link#Subpage feature</translate>]]
* [[Special:PrefixIndex]] — Provides a list of subpages.
* {{ll|Help:Variables#Page-names}}
* [[mw:Category:Subpage extensions]]
* [[Special:PrefixIndex]] — <translate><!--T:34--> Provides a list of subpages.</translate>
* {{ll|Category:Subpage extensions}}
* [[w:Subpages]]
* [[w:Subpages]]


[[Category:Help{{#translation:}}|{{PAGENAME}}]]
[[Category:Help|{{PAGENAME}}]]
[[Category:Subpage{{#translation:}}|{{PAGENAME}}]]
[[Category:Subpage|{{PAGENAME}}]]

Latest revision as of 04:17, 15 February 2022

PD Note: When you edit this page, you agree to release your contribution under the CC0. PD

Subpages introduce some hierarchical organization into wiki pages, with levels of the hierarchy separated by slashes (/).

Where it works

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.

How it works

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

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).

Use of subpages

There are various uses for the subpage feature. Some of the typical usages of subpages are:

  • to create archives of old discussions under a talk page
  • to create scratchpad editing spaces under a user page
  • to create other-language versions of a document in multilingual wikis
  • to create a template's subpages for its documentation, for its code sandbox, for its testcases, and for any subtemplate code

Subpages are useful for organising information hierarchically. On the other hand, subpages tend to have a long name that is hard to remember, so it may be more user-friendly to use them as little as possible. You can also organize pages with the category feature, which is more suitable for creating a hierarchical network of information.

Displaying subpages

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

{{Special:PrefixIndex/Help:Subpages/}}

Which produces this:

Since the magic word {{FULLPAGENAME}} outputs the current page, the general wiki markup to show all subpages of the current page is {{Special:PrefixIndex/{{FULLPAGENAME}}/}}. You can pass parameters to this, e.g. {{Special:PrefixIndex/{{FULLPAGENAME}}/ |hideredirects=1 |stripprefix=1}}

The subpage extensions, such as mw:Extension:SubPageList, let you customize the display of subpages.

Bypass subpages using alternative characters

As a consequence of the forward slash being a reserved character when subpages are enabled, an alternative character might be needed. Back slashes (\) are treated as normal characters in subpage naming and can be used in place of forward slashes. Additionally, as a crude hack, a character similar to the forward slash can be used instead, such as the "big solidus" (U+29F8), which results in Foo⧸bar (cf. a real slash: Foo/bar), or the solidus (U+2044), which results in Foo⁄bar. Three possible technical disadvantages (apart from the visual difference from a real slash) arise from this hack:

  1. People without the necessary fonts won’t be able to view the character properly;
  2. Redirects from the title with a slash must be created, so that linking and search will work correctly.
  3. Both the subject and talk versions of a page (and their corresponding subpages, e.g. discussion archives) need to use the hack, so that moving a page would take all connected pages to the new title (if that setting is selected during the move). For example, subpages are disabled in the main namespace in Wikipedia, so while the talk page won't work unless the solidus character is used to prevent having them marked as subpages, the corresponding page in the main namespace could accidentally keep an actual slash. The risk is that the visual similarity might make this go unnoticed by human editors.

See also