MediaWiki extensions manual
Release status: stable
Implementation Parser extension , Parser function
Description Adds a parser function to get the amount of headers or sections in a page.
Author(s) Eli Foster (SatanicSantatalk)
Latest version 1.0.6 (2024-03-02)
License MIT License

The HeaderCount extension adds a simple parser function for obtaining the number of headers, or sections, in a page.

The extension is invoked with the {{#headcount:...}} parser function.

Installation edit

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

Usage edit

Using this extension is fairly straight forward. The #headcount function has 2 parameters: page, and level.

When the first parameter is omitted ({{#headcount:}}), it will use the current page.

When the second parameter is omitted ({{#headcount:Page}}), it will use 2, as in level 2 headers.