Created page with "{{DISPLAYTITLE:Header or footer in the page content}} The HeaderFooter extension allows you to include a header or footer in the content area of a wiki page. This function can be applied to individual pages or entire namespaces. Usage examples can be found here. == Subpage list == If the wiki is structured primarily using subpages, it is useful to automatically display the subpages of a page at the beginning or end of the parent page. File:Hf-Unterseitenliste.png|750..." Tag: 2017 source edit |
No edit summary |
||
Line 4: | Line 4: | ||
== Subpage list == | == Subpage list == | ||
If the wiki is structured primarily using subpages, it is useful to automatically display the subpages of a page at the beginning or end of the parent page. | [[File:headerFooter with subpage list.png|alt=A topics page that shows its subpages as a list in the header section of the page.|center|thumb|750x750px|Namespace header listing subpages]] | ||
If the wiki is structured primarily using subpages, it is useful to automatically display the subpages of a page at the beginning or end of the parent page. | |||
To automatically display the subpages of a page in the main namespace at the beginning of a page: | To automatically display the subpages of a page in the main namespace at the beginning of a page: |
Latest revision as of 09:49, 11 July 2025
The HeaderFooter extension allows you to include a header or footer in the content area of a wiki page. This function can be applied to individual pages or entire namespaces. Usage examples can be found here.
Subpage list

If the wiki is structured primarily using subpages, it is useful to automatically display the subpages of a page at the beginning or end of the parent page.
To automatically display the subpages of a page in the main namespace at the beginning of a page:
- Create the page
MediaWiki:Hf-nsheader-
with the following content in the source code. (Note the hyphen at the end of the page name!)<div class="hf-navbox"> <div class="hf-nav" aria-role="navigation" aria-label="Subpages" >{{#ifeq:{{SUBPAGENAME}}|{{PAGENAME}}|| ← [[{{NAMESPACE}}:{{BASEPAGENAME}}|{{BASEPAGENAME}}]]}} <div class="hf-subpages">{{#subpages:kidsonly=yes|default=<span class="default"> </span>}} </div></div></div>
- Insert the desired output formatting in
MediaWiki:Common.css
. In this example, the page names are displayed in three columns with a gray background:/*Styles for subpage navigation via the HeaderFooter extension */ .hf-navbox {background: #f2f3f9; padding:1em; margin-bottom:2em} .hf-subpages .subpagelist {padding-top:0.5em; columns:3} .hf-subpages .default {display:none; line-height:0; overflow:hidden} /*avoid empty space if there are no subpages*/
The subpages are output using the parser function {{#subpages:}} from the bundled SubPageList extension. The output volume (e.g., outputting the subpage tree instead of just the immediate subpages as in the example) and other parameters can be adjusted ([https://github.com/ProfessionalWiki/SubPageList/blob/master/doc/USAGE.md).