MediaWiki extensions manual
OOjs UI icon advanced-invert.svg
Release status: unmaintained
Implementation Parser function
Description Automatically creates subpage links in parent page.
Author(s) Peter Gostelow (PeterMGtalk)
Latest version 0.0.3
MediaWiki 1.14+
License GNU General Public License 2.0
Download LibrePlanet
The parent page may need to be dummy edited to reflect subpage name changes. This may be an optimization issue.
Example {{#subpages: Help}}

Check usage and version matrix.

The SubPageFunctions extension automatically creates subpage links in parent page.

When creating a tree of subpages, this extension will provide navigation links from a parent page to its immediate subpages. It is the counterpart to the wiki's parent page links.

You may slice and dice subpage names to select parts of the name using the pathname function.

When compiling educational documents, you may create a table linking to them, using the calendar function.

The user function returns the current user name, useful when creating personalised pages.



The syntax is

{{#subpages: [NAMESPACE | 0]}}


is an optional namespace name, e.g. Project, Help, MyNamespace, etc.
0 (numerical zero)
is the main namespace, often called Article.

The default is to use the page's namespace, so you can omit the argument. You may use the function more than once for different namespaces.

You may add the function anywhere on the page. It will create a centered title and a three column list of subpage links. If there are no subpages, the function will output nothing.


The syntax is

{{#pathname: start [|length]}}


An integer representing the first component in the pathname.
An integer representing the number of components.

The pathname can be trimmed from both the front or back. The length is similarly selected from either the front or back.

Given the page name

// front of name
{{#pathname: 0|1}} // returns foo
{{#pathname: 0|3}} // returns foo/bar/baz
{{#pathname: 1|3}} // returns bar/baz/widget
// back of name
{{#pathname:-1}}   // returns fum
{{#pathname:-3}}   // returns fie/foe/fum
{{#pathname:-3|2}} // returns fie/foe
// back length
{{#pathname:3|-2}} // returns baz/widget (not widget/fee)
{{#pathname:-3|-2}} // returns fee/fie (not fie/foe)

It only operates on the current page name in a similar way to {{BASEPAGENAME}} and {{SUBPAGENAME}}, so you cannot pass it arbitary text. It becomes useful when using more than three subpage levels.


The syntax is

{{#calendar: [namespace][|pageprefix]}}


The namespace of the target pages.
The parent page in the namespace.

Returns a table where the columns are subpages of pageprefix and the rows are sub-subpages of pageprefix. If pageprefix is omitted, the current page name is used. If the namespace is omitted, the current page's namespace is used.

Given the following pages:


the function in the Extension:SubPageFunctions page

{{#calendar: |SubPageFunctions/example}}

will produce the following table:

Module/Level 101 102 103
examples Available N/A Available
intro Available Available N/A

If a page is a redirect, it is marked as Redirect instead of Available. The row names examples and intro are composite names taken from the sub-subpages.


The syntax is


This function takes no arguments and returns the current logged in user name. This is useful when creating user subpages, for example, given the current user is Foo:


will link to:


The actual link will vary from user to user, creating multiple unique pages by user name, but each user will only see their link. The function can be used anywhere text is allowed, not just links. Most useful with Semantic MediaWiki and SemanticForms.


  • Download, extract and place the file(s) in a directory called SubPageFunctions in your extensions/ folder.
  • Add the following code at the bottom of your LocalSettings.php :
    require_once "$IP/extensions/SubPageFunctions/SubPageFunctions.php";
  •   Done – Navigate to Special:Version on your wiki to verify that the extension is successfully installed.

See alsoEdit