These are the usage instructions for the SubPageList extension.
You have the choice to either use the tag extension <subpages />
or use the parser function {{#subpages: }}
. These take the
same parameters and behave identically.
Parameter name: page
The page to show the subpages for. Defaults to the current page.
Parameter name: format
Supported values:
ol
for ordered lists (those with numbers)ul
for unordered lists (those with bullets)
Default: ul
Parameter name: pathstyle
This parameter controls how page titles are displayed in the list. The default is subpagename
.
The below table demonstrates how two different titles are formatted for each of the supported values.
Supported values | ||
---|---|---|
Value | Namespace:Foo/Bar/Baz | Namespace:Title |
full |
Namespace:Foo/Bar/Baz | Namespace:Title |
pagename |
Foo/Bar/Baz | Title |
subpagename |
Baz | Namespace:Title |
none |
Baz | Title |
Header parameter name: intro
Footer parameter name: outro
These parameters allow you to specify content to be placed before and after the list of sub pages. This context can be simple wikitext. Footer and header are displayed within the same HTML element (div, span, etc) the list itself is located in. They are also only shown if the list itself is shown. This means header and footer will not be displayed if the list is empty.
Parameter name: default
This parameter allows you to specify contents to display when the sub page list is empty. This could be a message such as "There are no sub pages to list".
Parameter name: links
This parameter specifies if the pages in the list should be links. The allowed values
are yes
and no
. The default is yes
.
Parameter name: redirects
This parameter specifies if subpages which are redirects should be included in the list.
The allowed values are yes
and no
. The default is no
.
Parameter name: showpage
This parameter indicates if the page itself should be displayed as part of the list.
The allowed values are yes
and no
. The default is no
.
Parameter name: kidsonly
This parameter indicates if only direct children of the page should be included in the list.
The allowed values are yes
and no
. The default is no
.
Parameter name: template
Allows specifying a MediaWiki template to format the page names with. The template gets a
single unnamed parameter which is the page name. The format of the page name depends on the
pathstyle
parameter.
Parameter name: addlevel
Allows user to specify an integer number of levels (up to 10) to add to bullets/numbers so resulting list can be appended to another list outside.
Example output for addlevel=2
:
*** Parent
**** Child 1
**** Child 2
Default: 0
Parameter name: element
Allowed values:
div
p
span
none
(since version 1.2)
Default: div
Parameter name: class
Class of the wrapping HTML element. Default: subpagelist
Parameter name: limit
This parameter specifies the limit used by the query that finds the subpages. It should be a whole number between 1 and 500, bounds included. The default is 200.
The size of the actual list might be a bit above the upper bound, as non-existing
pages in the subpage tree get added to it. It might also be lower then the upper
bound even when there are more pages then the specified limit, as certain parameters
(i.e., kidsonly
) omit pages from the result set.
Parameter name: sort
Alphabetic sorting order of the pages. The allowed values are asc
for ascending (A first)
and desc
for descending (Z first). The default is asc
.
This sort is applied after the limit to the resdult set. So this is not a global sort.
When using the parser function, a number of parameters can be provided without specifying their name. Those parameters are listed below, in order:
page
format
pathstyle
sort
This means you can do {{#subpages:YourPageName|ol}}
instead of {{#subpages:page=YourPageName|format=ol}}
.
When using the tag extension, one can specify the name of the page to use by putting
it in between tags: <subpagelist>YourPageName<subpagelist>
rather
then using the named equivalent <subpagelist page="YourPageName" />
.
Listing the subpages of the current page using default settings:
{{#subpages:}}
Listing subpages for page "MyAwesomePage":
{{#subpages:MyAwesomePage}}
Listing subpages using an ordered list:
{{#subpages:format=ol}}
Full page names that are not linked:
{{#subpages:pathstyle=full|links=no}}
Adding a header and a footer:
{{#subpages:into=Awesome subpages below!|outro=Now go add some more!}}
Using a template to format the page names:
{{#subpages:template=MyAwesomeTemplate}}
Where Template:MyAwesomeTemplate contains for instance: A subpage called {{{1}}}
You have the choice to either use the tag extension <subpagecount />
or use the parser function {{#subpagecount: }}
. These take the
same parameters and behave identically.
The only parameter is page
, which defaults to the current page.
The page itself is not included in the subpage count. So if the page has no subpages, the count will be 0.
Counting the subpages of the current page:
{{#subpagecount:}}
Counting the subpages of page "MyAwesomePage":
{{#subpagecount:MyAwesomePage}}