MkDocs Pagetree Plugin

MkDocs plugin that allows you to display the page tree. Like sitemap.xml, but for humans. This plugin replaces the pagetree marker with an actual pagetree.

Setup

Install the plugin (PyPI package) with pip:

pip install mkdocs-pagetree-plugin

Configure via mkdocs.yml:

plugins:
  - pagetree

Options

The following tree options for the pagetree marker exists (see the demo section for integration):

  • {{ pagetree(all) }}

    Render the whole pagetree. This is the default tree option, the (all) parameter can also be omitted.

  • {{ pagetree(children) }}

    Render only direct children of the current page

  • {{ pagetree(siblings) }}

    Render only direct siblings of the current page, excluding the current page

  • {{ pagetree(subtree) }}

    Render the subtree which contains the current page

Notes

  • The plugin or marker can be used on several pages.
  • Only the first occurrence of the marker {{ pagetree }} on a page is replaced.
  • If any page status is used (Ref), allow filtering the pagetree for these statuses.
  • If no page with the status attribute exists, the filter will not be rendered.
  • Don't want the buttons? Hide them with some CSS:

    .pagetree-functions { display: none; }

  • This plugin may not be compatible with the following MkDocs plugins:

Demo

Code

# docs_dir/file.md

{{ pagetree }}

Rendered