From MediaWiki.org
Jump to navigation Jump to search
MediaWiki extensions manualManual:Extensions
Crystal Clear action run.svg

Release status:Extension status stable

ImplementationTemplate:Extension#type Parser extension, Parser function
DescriptionTemplate:Extension#description Quickly counting the number of sections/headers in a page.
Author(s)Template:Extension#username Eli Clemente Gordillo Foster (SatanicSantatalk)
Latest versionTemplate:Extension#version 1.0.4 (October 19, 2017)
LicenseTemplate:Extension#license MIT License
Hooks usedTemplate:Extension#hook

Translate the HeaderCount extension if it is available at translatewiki.net

Check usage and version matrix.

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.


  • 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:
    require_once "$IP/extensions/HeaderCount/HeaderCount.php";
  • YesY Done - Navigate to Special:Version on your wiki to verify that the extension is successfully installed.


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.