Template:Subpages: Difference between revisions

From Freephile Wiki
wrap the doc template in noinclude tags
be explicit and add parameters
 
Line 1: Line 1:
<includeonly>
<includeonly>
== Subpages ==
== Subpages ==
{{#subpages:}}
{{#subpages:
page={{PAGENAME}}
|format=ul
|default="There are no subpages of the current page"}}
</includeonly>
</includeonly>
<noinclude>
<noinclude>
{{doc}}
{{doc}}
</noinclude>
</noinclude>

Latest revision as of 22:08, 15 September 2025


Documentation icon Template documentation[view] [edit] [history] [purge]

This template just adds a heading above the SubPageList parser function call.

You must pass an empty argument (the pipe character) in order to get the correct output due to a quirk with how template calls are given default arguments that would otherwise change the output of the parser function.


By transcluding this template with {{Subpages|}} you get

{{#subpages:
page={{PAGENAME}}
|format=ul
|default="There are no subpages of the current page"}}

wherever you want to show a list of links to subpages.

The parser hook used comes from the mw:Extension:SubPageList extension, and the documentation gives further examples of customizing the output https://github.com/ProfessionalWiki/SubPageList/blob/master/doc/USAGE.md

Simple template to create a heading and invoke the #subpages parser function.

Template parameters[Edit template data]

This template prefers inline formatting of parameters.

ParameterDescriptionTypeStatus
No parameters specified