Note
If you are looking for a suitable Markdown editor, or are using Obsidian, then there is a plugin with basically the same functionality available here.
A simple mkdocs plugin, enables to organize Navigation in a more markdownic way.*
This plugin tries to read markdown resources before mkdocs, which may add some performance overhead on building.
Four additional keys can be configured in Markdown Metadata ( also known as "front-matter", see metadata).
-
weight: number
- Value: number, eg:
-1
,2.3
..., if unset, it goes0
. - like weight in Hugo but has some differences, used for ordering your sections/pages. Lower weight gets higher precedence. So content with lower weight will come first.
weight
in anindex
will be offered to its parentsection
, there is a fixed value for itself, and the value is configurable, see:index_weight
.- For those who are confused, only weights of the items in the same folder will be compared
- Value: number, eg:
-
headless: bool
- Value: bool,
true
orfalse
, if unset, it goesfalse
. - like headless in Hugo, pages/sections with
headless: true
will be hidden from nav, but these contents will still be rendered and accessible via URL. headless
in anindex
will be offered to its parentsection
.
- Value: bool,
For index
only:
-
retitled: bool
- Value: bool,
true
orfalse
, if unset, it goesfalse
. - A metadata version of
section_renamed
which only applies thisindex
's title to its parentsection
, it only works whensection_renamed
isfalse
.
- Value: bool,
-
empty: bool
- Value: bool,
true
orfalse
, if unset, it goesfalse
. - If there is an
index
only used to offer metadata for its parentsection
and without any meaningful content, settingempty
totrue
can help you to hide thisindex
itself.
- Value: bool,
Install with pip
:
pip install mkdocs-nav-weight
Add the following lines to mkdocs.yml
plugins:
- search
- mkdocs-nav-weight
Configure in mkdocs.yml
:
plugins:
- search
- mkdocs-nav-weight:
section_renamed: false
index_weight: -10
warning: true
reverse: false
headless_included: false
Default: false
:
-
If
true
, section name will use thetitle
of itsindex
instead of the folder name. -
For compatibility we have to name a folder like "C#" as "CSharp", but what we actually want is "C#" , that's what this option does
Default: -10
:
- The
weight
value forindex
itself, to ensure it's always the first at the same level
Default: true
:
- Controls whether to send a
Warning
when invalid values are detected in markdown metadata
Default: false
:
- If
true
, sort nav byweight
from largest to smallest.
Default: false
:
-
An option to control whether
headless
pages should be included innav.pages
which is used by some plugins, eg: mkdocs-pdf-export-plugin. -
If
true
,headless
pages will be included.