An installable collection of pages for easy menu insertion into Mediawiki sidebar.
A multilevel collapsible menu (the first level is always expanded). Served via Mediawiki:Sitenotice using Template:Global menu.
Advantage: Appears on all pages.
Navigate to Mediawiki:Global-menu and plan your menu in format:
* [[RootPageName]]
** [[RootPageName/SubpageName1|SubpageName1]]
** [[RootPageName/SubpageName2|SubpageName2]]
*** [[RootPageName/SubpageName2/SubSub1|SubSub1]]
*** [[RootPageName/SubpageName2/SubSub2|SubSub2]]
** [[RootPageName/SubpageName3|SubpageName3]]
...A flat menu block with the title. Menu is shown if the current page belongs to the given category. Create a page Mediawiki:Sidebar/Category:NameOfYourCategory and plan your menu in format:
* MenuBlockTitle
** PageName1|LinkText1
** PageName2|LinkText2
** PageName3|LinkText3
...For details refer to the extension documentation
A multilevel collapsible menu.
"Project" means hierarchy of subpages derived from the root page. Menu is shown if there is a page in Menu: namespace matching the name of the root page of the current page / subpage. It means the menu will be shown on the root page and on all subpages.
Advantage: You can manage the order and level of pages.
Create a page in Menu: namespace matching the name of the root page of the current page / subpage and plan your menu in format:
* [[RootPageName]]
** [[RootPageName/SubpageName1|SubpageName1]]
** [[RootPageName/SubpageName2|SubpageName2]]
*** [[RootPageName/SubpageName2/SubSub1|SubSub1]]
*** [[RootPageName/SubpageName2/SubSub2|SubSub2]]
** [[RootPageName/SubpageName3|SubpageName3]]
...Advantage: Menu is auto updating as new subpages are added.
Create a page in Menu: namespace matching the name of the root page of the current page / subpage and put a call to the Template:Automenu:
{{automenu|1}}where 1 is the level menu should be started at (for nested menus). For details refer to the extension documentation
To simplify the display title of the subpages, please, use Template:Subpage title, like this:
{{subpage title}}
Using a category tree in the sidebar for site navigation is not recommended. We just provide a link to the Special:CategoryTree via Mediawiki:Sidebar. In the Category namespace the link is changing to View as a tree and takes visitors to a category tree built from the current category.
The User- and the Group-specific menus are also available as a part of DynamicSidebar extension:
- Group menus must be created under
MediaWiki:Sidebar/Group:<group>. - Users are able to create their own custom sidebar blocks under
User:<username>/Sidebar.
❗ Not included. Needs additional development
Adding semantic annotations to pages will make it possible to generate hierarchical/nesting trees with logical sorting (eg. using SemanticResultFormats. etc), which can be injected into the infrastructure created: just replace manually created menus with the semantic query code.
- SemanticMediaWiki Provides Modification date
- DynamicSidebar Provides CATEGORY-SIDEBAR
- Gadgets Loads JS
- PageNotice Provides Mediawiki:Bottom-notice-ns-0
- ParserFunctions (with
$wgPFEnableStringFunctions = true;) - SubpageFun Provides useful magic words (incl. TOPLEVELPAGE)
- SubPageList Provides a parser function for menu content auto creation
- TreeAndMenu Provides expandable multilevel menus
- UserFunctions Provides
{{#ifsysop: ... }} - PageExchange for importing content
The package is designed to work with the Vector sidebar. The work with other skins featuring a sidebar may require ajustments to the package CSS, JS and/or HTML.
We'll store TreeAndMenu menus in a custom namespace. A menu for the page SomePage will be stored as Menu:SomePage.
Add this to LocalSettings.php:
define("NS_MENU", 3000); // This MUST be even.
define("NS_MENU_TALK", 3001); // This MUST be the following odd integer.
$wgExtraNamespaces[NS_MENU] = "Menu";
$wgExtraNamespaces[NS_MENU_TALK] = "Menu_talk";
$wgNamespacesWithSubpages[NS_MENU] = true;
$smwgNamespacesWithSemanticLinks[NS_MENU] = true;Run from Mediawiki install directory:
COMPOSER=composer.local.json composer require --no-update mediawiki/semantic-media-wiki
COMPOSER=composer.local.json composer require --no-update mediawiki/sub-page-list
composer update --no-dev -oThen enable SMW in LocalSettings.php:
enableSemantics( 'parasol' ); #SemanticMediawikiRunning update.php is required:
php maintenance/update.php --quickClone repos into extensions directory and enable the extensions in LocalSettings.php:
wfLoadExtension( 'DynamicSidebar' );
wfLoadExtension( 'Gadgets' );
wfLoadExtension( 'PageExchange' );
wfLoadExtension( 'PageNotice' );
wfLoadExtension( 'ParserFunctions' );
wfLoadExtension( 'SubpageFun' );
wfLoadExtension( 'SubPageList' );
wfLoadExtension( 'TreeAndMenu' );
wfLoadExtension( 'UserFunctions' );Set in LocalSettings.php:
$wgAllowSiteCSSOnRestrictedPages = true;
$wgRestrictDisplayTitle = false;
$wgNamespacesWithSubpages[NS_MAIN] = true;
$wgDynamicSidebarUsePageCategories = true;
$wgUFAllowedNamespaces = array_fill( 0, 4000, true );
$wgPFEnableStringFunctions = true;
$wgEnableSidebarCache = false;
$GLOBALS['egSPLAutorefresh'] = true;Optionally install and enable:
wfLoadExtension( 'VisualEditor' );- add the following to the bottom of your
LocalSettings.php:
$wgPageExchangePackageFiles[] = 'https://raw.githubusercontent.com/wikivisor/mediawiki-pages-DynamicMenu/master/page-exchange.json';- navigate to
Special:Packagesand install the package - (optional) from the wiki root, run
php maintenance/runJobs.php
Import styles by adding the following into MediaWiki:Vector.css:
@import url("/w/index.php?action=raw&ctype=text/css&title=MediaWiki:DynamicMenu.css");Note: Adjust the URL according to your paths/rewrite rules.