DokuWiki

It's better when it's simple

User Tools

Site Tools


plugin:lightmenu

lightmenu Plugin

Compatible with DokuWiki

  • 2025-05-14 "Librarian" yes
  • 2024-02-06 "Kaos" unknown
  • 2023-04-04 "Jack Jackrum" unknown
  • 2022-07-31 "Igor" unknown

plugin Very simple plugin which display pure CSS tree menu (inspired from "bisserof" https://codepen.io/bisserof) of wiki hierarchy. Now with menu label customization and sorting options.

Last updated on
2025-05-13
Provides
Syntax, Action
Repository
Source

Installation

Search and install the plugin using the Extension Manager. Refer to Plugins on how to install plugins manually.

Features

  • Customizable menu label
  • Option to use first page header as menu label
  • Customizable menu entry html attribute (color, font, css class…)
  • Sorting option with multiple order criteria.

Examples/Usage

the “<lightmenu [options]>” string will be replace by HTML code of the wiki hierarchy. Just put “<lightmenu [options]>” inside “sidebar.txt”. If your theme display a sidebar the light menu will appear in it. Where [options] is a list, potentially empty, of options separate by spaces.

options :

  • “-head” : to use first page title as menu label. (Only title “====== big tittle ======” with 6 “=” will be used.)
  • “-sort=list-of-criteria” : define menu entry order by a list of comma separated criteria names. (see sorting section)

Syntax

Add lightmenu in the side bar

To display the menu add :

<lightmenu //options//>

in sidebar page.

Page meta data

Meta data can be added to a page to change parameters of the corresponding menu entry.

To customize page menu label name and style add in your page (this do not appear into page when displayed). :

<lm:{
 "label":"possible new label",
 "a_html_a_tag_attribute":"html_attribute_possible_value",
 "a_html_a_tag_attribute":"html_attribute_possible_value",
 ...
}>

Any string not begin with the “_” (underscore) character is used as html attribute of the menu entry link. Except for “label”, “head”, “href”, “title”. see HTML5 attributes of “a” tag.

Example :

<lm:{
  ...
  "class":"mycssclass",
  "style":"color:red"
  ...
}>

Sorting

Order criteria

Order criteria are string made of two string separated by “_” character.

The first string is the type of criteria. This criteria are defined by the plugins :

  • “type” : represent the type of entry, single page or category.
  • “id” : the dokuwiki unique page identifier inside a category.
  • “label” : the label defined in lightmenu page meta data or the first header of page.
  • “date” : the last modified time of the page.
  • your_own : a criteria you want to define in the lightmenu page meta data.

The second string is the sorting direction :

  • “asc” : lower first
  • “desc” : greater first

If no sorting option is defined, the default option is :

type_asc,id_asc

If all criteria are the same the unique ids are compared.

Chaining order criteria

A list of order criteria can be define. If two criteria are equal then the next criteria in the list is used to compare two entries.

Examples

<lightmenu -sort=label_asc>

Sort menu entry using only label or first header (categories and page are mixed).

<lightmenu -sort=type_asc,label_asc>

Categories appear before pages then the menu is sorted using label.

<lightmenu -sort=date_desc,label_asc>

Menu display last modified pages first, if two time are the same label is used.

Change sort criteria of a menu sub tree

Order criteria can be contradict in sub categories. The new order criteria are then inherited by child categories.

In a index page (start page) of a category you can add “_sort” meta data key :

<lm:{
   ...
   "_sort":"type_desc,label_asc",
   ...
}>

Define your own criteria

In a page :

<lm:{
   ...
   "_oc_mychosenname":130,
   ...
}>

Then in options use order criteria : “mychosenname_asc” or “mychosenname_desc”.

For example, you may use it to have pages always on the top :

In the page “read_first” :

<lm:{
   ...
   "_oc_rank":1,
   ...
}>

Then the first criteria : “rank_asc”

Any page without the rand criteria definied (“_oc_rank” key) will appear after this one.

To have a page just below add for example :

<lm:{
   ...
   "_oc_rank":2,
   ...
}>

in it.

String comparison

The strings are compare using the lexicographic order of the page language (will only work if PHP “intl” extension have been installed)

If the a criteria does not exist on the page it is always considered as greater than any other.

Types comparison

Category” type is considered lower than “page” type.

Date/time comparison

Older is lower, Newer is greater.

Adding lightmenu to an existing wiki

If you use Lightmenu on a wiki with existing pages you can go to the admin page “Additional Plugins” section, “Lightmenu” page add click “rescan” to add all page first header to lightmenu meta data (This action only need to be done one time).

see README.md at https://github.com/graviemi/dokuwiki-plugin-lightmenu/

Configuration and Settings

none

Development

The source code of the plugin is available at GitHub: https://github.com/graviemi/dokuwiki-plugin-lightmenu/.

Changelog

Known Bugs and Issues

none for now.

ToDo/Wish List

nothing for now.

FAQ

plugin/lightmenu.txt · Last modified: by 152.77.119.211

Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Share Alike 4.0 International
CC Attribution-Share Alike 4.0 International Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki