A simple mkdocs plugin, enables to organize Navigation in a more markdownic way.
Project description
mkdocs-nav-weight
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.
Usage
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.
weightin anindexwill be offered to its parentsection, there is a fixed value for itself, and the value is configurable, see:index_weight.
- Value: number, eg:
-
headless: bool- Value: bool,
trueorfalse, if unset, it goesfalse. - like headless in Hugo, pages/sections with
headless: truewill be hidden from nav, but these contents will still be rendered and accessible via URL. headlessin anindexwill be offered to its parentsection.
- Value: bool,
For index only:
-
retitled: bool- Value: bool,
trueorfalse, if unset, it goesfalse. - A metadata version of
section_renamedwhich only applies thisindex's title to its parentsection, it only works whensection_renamedisfalse.
- Value: bool,
-
empty: bool- Value: bool,
trueorfalse, if unset, it goesfalse. - If there is an
indexonly used to offer metadata for its parentsectionand without any meaningful content, settingemptytotruecan help you to hide thisindexitself.
- Value: bool,
Installation
Install with pip:
pip install mkdocs-nav-weight
Add the following lines to mkdocs.yml
plugins:
- search
- mkdocs-nav-weight
Options
Configure in mkdocs.yml:
plugins:
- search
- mkdocs-nav-weight:
section_renamed: false
index_weight: -10
warning: true
reverse: false
section_renamed
Default: false:
-
If
true, section name will use thetitleof itsindexinstead 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
index_weight
Default: -10:
- The
weightvalue forindexitself, to ensure it's always the first at the same level
warning
Default: true:
- Controls whether to send a
Warningwhen invalid values are detected in markdown metadata
reverse
Default: false:
- If
true, sort nav byweightfrom largest to smallest.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters