MkDocs Awesome Nav Plugin
A plugin for customizing the navigation structure of your MkDocs site. It enhances the standard MkDocs navigation with features like glob patterns, dynamic sorting, and conditional visibility, allowing for more flexible site organization. The current version is 3.3.0, and it follows a feature-driven release cadence with occasional major updates.
Common errors
-
Plugin 'awesome-nav' not found.
cause The plugin `mkdocs-awesome-nav` is either not installed or is misspelled in the `mkdocs.yml` file.fixEnsure the plugin is installed (`pip install mkdocs-awesome-nav`) and correctly listed as `awesome-nav` under `plugins` in your `mkdocs.yml`. -
Configuration error: The option 'nav_sections' is not allowed for the awesome-nav plugin.
cause You are using the deprecated `nav_sections` option with mkdocs-awesome-nav v3.x or higher.fixRemove `nav_sections` from your `mkdocs.yml`. If you need to manage navigation sections, consult the v3.x documentation for alternatives, primarily using the main `nav` section or the new `sections` configuration. -
mkdocs.plugins.base.PluginCollectionError: Plugin 'awesome-nav' could not be loaded: ImportError: 'mkdocs' requires a 'plugins' object with the following attributes:...
cause This error can occur if your MkDocs version is too old for `mkdocs-awesome-nav` v3.x, or there's a fundamental issue with the MkDocs installation.fixUpgrade MkDocs to version 1.5.0 or higher: `pip install --upgrade "mkdocs>=1.5.0"`. Also, verify your Python version is 3.10 or newer.
Warnings
- breaking The `nav_sections` configuration option was removed in version 3.0.0 and replaced by the `sections` option, which has different functionality.
- breaking Version 3.0.0 and higher of mkdocs-awesome-nav requires MkDocs >= 1.5.0 and Python >= 3.10.
- gotcha The plugin must be explicitly listed under the `plugins:` section in your `mkdocs.yml` file to be active.
Install
-
pip install mkdocs-awesome-nav
Quickstart
# mkdocs.yml
site_name: My Awesome Docs
plugins:
- awesome-nav
nav:
- Home: index.md
- 'User Guide':
- guide/*.md # Example of a glob pattern
- 'API Reference': api/
# To build the site:
# mkdocs build
# To serve the site locally:
# mkdocs serve