Last edited 3 days ago
by Redaktion

Header or footer in the page content

Revision as of 09:38, 11 July 2025 by Redaktion (talk | contribs) (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...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)


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. alternative text=Header in page content with subpages of the "Technology" page

To automatically display the subpages of a page in the main namespace at the beginning of a page:

  1. 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}}|| &larr; [[{{NAMESPACE}}:{{BASEPAGENAME}}|{{BASEPAGENAME}}]]}}
    <div class="hf-subpages">{{#subpages:kidsonly=yes|default=<span class="default">&nbsp;</span>}}
    </div></div></div>
    
  2. 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).



PDF exclude - start

To submit feedback about this documentation, visit our community forum.

PDF exclude - end