Template:Subpages/doc: Difference between revisions

From Freephile Wiki
No edit summary
No edit summary
 
(6 intermediate revisions by the same user not shown)
Line 1: Line 1:
BROKEN
This template just adds a heading above the [https://github.com/ProfessionalWiki/SubPageList/blob/master/doc/USAGE.md SubPageList] parser function call.


TLDR;
{{Messagebox
Use something like
|text=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.
<pre>
}}
== Subpages ==
 
{{#subpages:}}
By transcluding this template with '''<nowiki>{{Subpages|}}</nowiki>''' you get
<pre>
<pre>
{{#subpages:
page={{PAGENAME}}
|format=ul
|default="There are no subpages of the current page"}}
</pre>
wherever you want to show a list of links to subpages.
wherever you want to show a list of links to subpages.


This template outputs (an unlinked) list of pages rather than links. If you use the #subpages parser hook IN a page, it works as intended, outputting page links.
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
 
<templatedata>
The parser hook used comes from the Subpages extension, and the documentation example seems to indicate that you can format output with a template, but doesn't say anything about using the parser function from a template. https://github.com/ProfessionalWiki/SubPageList/blob/master/doc/USAGE.md
{
"params": {},
"description": "Simple template to create a heading and invoke the #subpages parser function.",
"format": "inline"
}
</templatedata>

Latest revision as of 22:29, 15 September 2025

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

This template prefers inline formatting of parameters.

ParameterDescriptionTypeStatus
No parameters specified