From mediawiki.org
MediaWiki extensions manual
Release status: unmaintained
Implementation Parser extension , Tag
Description Allows for a simple sidebar menu which supports infinite number of sub-menus.
Author(s) Kim Eik (Netbraintalk)
Latest version 0.2 (2013-10-16)
MediaWiki MW 1.17+
PHP 5.3+
Database changes No
Composer mediawiki/side-bar-menu
License GNU General Public License 3.0 or later
Quarterly downloads 29 (Ranked 120th)
Translate the SideBarMenu extension if it is available at translatewiki.net

The SideBarMenu extension allows the creation of multilevel menus through the tag <sidebarmenu/>

Despite the name, menus created by this extension are not intended to actually be placed in the sidebar. This extension was created to create a custom menu in a article or set of articles through the use of templates.[1]


Download and install using Composer, as of c1730 this is the only way of installing and running this extension (however not verified).

  • Download and move the extracted SideBarMenu folder to your extensions/ directory.
    Developers and code contributors should install the extension from Git instead, using:cd extensions/
    git clone https://gerrit.wikimedia.org/r/mediawiki/extensions/SideBarMenu
  • Add the following code at the bottom of your LocalSettings.php file:
    require_once "$IP/extensions/SideBarMenu/SideBarMenu.php";
  • Yes Done – Navigate to Special:Version on your wiki to verify that the extension is successfully installed.

Configuration parameters[edit]

Name Description Global example usage Instance example usage Default setting
show Sets the text to be displayed on expandable menu items
$wgSideBarMenuConfig['show'] = '[show]';
<sidebar show="[show]"> null
hide Sets the text to be displayed on collapsable menu items
$wgSideBarMenuConfig['hide']= '[hide]';
<sidebar hide="[hide]"> null
animate Whether to use animations when expanding/collapsing menuitems
$wgSideBarMenuConfig['animate'] = true;
<sidebar animate="true"> true
expanded Default behavior of menuitem nodes when no expand/collaps flag is supplied in sidebarmenu tag syntax
$wgSideBarMenuConfig['expanded'] = true;
<sidebar expanded="true"> true
editlink Shows/hides a edit link which points to the edit page wherever the sidebarmenu is declared
$wgSideBarMenuConfig['editlink'] = true;
<sidebar editlink="true"> true
minimized Menu starts out as minimized if true
$wgSideBarMenuConfig['minimized'] = false;
<sidebar minimized="true"> false


You can use CSS to customize the appearance of the sidebar and override the default CSS styles. To get started take a look in the file /css/ext.sidebarmenu.css.

You can also override css styles on a per menu item level. The styles will attach itself to the <li> tag. You can override css styles in two ways:

  1. using the style parameter. e.g **MenuItem|style=font-weight:bold;font-size:16px;
  2. using the class parameter. e.g **MenuItem|class=some-defined-css-class another-css-class

As a late addition, you can also set the class property on the sidebarmenu tag to add custom classes to the root container of the sidebarmenu. This way you can create your own stylesheet and have several sidebarmenu's with their own styling.


<sidebarmenu class="myCustomClass">

Through this method you could make the sidebarmenu look completely different.

Syntax explanation[edit]

  • Each newline represents a new menu item.
  • The first character of a line (either '+' or '-') determines if the menu item's children are visible or hidden
  • The number of '*' characters determines where in the tree the menu item should be placed.
  • A '@' prefix of a menu item, makes that menu item clickable which in turn expands or collapses submenu.
  • The rest of the line is interpreted as wikitext.
  • The input also accepts other mediawiki syntax, e.g <sidebarmenu>{{Template}}</sidebarmenu>
  • #subpage <page> would render a tree of subpages in the sidebarmenu.


Given that the wiki is configured with $wgNamespacesWithSubpages , and that the pages A, A/B, and A/B/C exists. A syntax of:

#subpage A

Would be the equivalent of:


The -/+ syntax can be used on the subpage functionality to give each element a prefix of +/- in the entire subtree.

See also: https://gerrit.wikimedia.org/r/#/c/90536/

Example syntax[edit]

MenuItem1                   <-- root menu item
*Child1                     <-- child of MenuItem1
**Child2                    <-- child of Child1
*Child3                     <-- child of MenuItem1
+@MenuItem2                 <-- new root menu item which has it's children visible (also clickable)
-*Child1                    <-- child of MenuItem1 which has it's children hidden
**Child2                    <-- child of Child1''''
*#subpage A                 <-- child of MenuItem1 which populates the tree with the page A and it's subpages
{{Template}}                <-- Wiki code that is evaluated, in this case a template inclusion

'+' or '-' determines whether the menu item should be expanded or collapsed, if neither is supplied at the beginning of a line then the default configured ('expanded') will decide.

The number of '*' characters determines the location in the hierarchy for the menuitem.

Note that wiki code evaluation needs to return a valid sidebarmenu syntax.

Example usage[edit]

The following code;

**[[Sports car]]
**[[Family car]]
***[[Large family car]]
***[[Small family car]]
**[[Fire truck | FIRE TRUCK]]
**[[Garbage truck]]
**[[Flatbed truck]]
**[[Tow truck]]

will result in the following (not entirely true as some changes has been made to the sourcecode): (Tip: You can now also give each menu item a different display name e.g [[Monster_Truck|Monster truck]] would display "Monster truck" instead of "Monster_Truck")

Example view of a sidebar menue