Open uechoco opened 6 months ago
Yes, currently this plugin always renders the whole page tree.
Your idea of only showing siblings and children of the current side sounds good and interesting. What options do you have in mind?:
all
→ the whole pagetree, current behaviourchildren
→ children of current page, recursivenamespace
→ current "namespace": siblings and children of the current page, recursiveHowever, this would have to be configurable somehow, I would have to take a look at it - or: a pull request is very welcome.
This plugin supports two three new "tree rendering options" from now on:
{{ 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{{ pagetree(subtree) }}
: Render the subtree which contains the current pageSome demo pages are available: https://tombreit.github.io/mkdocs-pagetree-plugin/
I would now consider this to be "beta", but you are welcome to test it. As I did not made a release for now, you could install it from git:
~~$ pip install git+https://github.com/tombreit/mkdocs-pagetree-plugin.git@150339881c3739ec87922c7bbb757216a9e4876a~~
$ pip install git+https://github.com/tombreit/mkdocs-pagetree-plugin.git@e666155cf936388199d050c73ab8c854f6f953d1
Thank you for your rapid support! I seem it works.
By the way, if mkdocs.yml includes nav tree settings, I seem that this plugin renders in range of nav tree definition. Is this behavior restriction of mkdocs? I sometimes forget to add a page to the nav tree settings. I thought it would be more useful to have an option to ignore the nav settings and display the file tree according to the files that actually exist.
Anyway, thank you again.
I don't use a nav
setting in this very project's mkdocs.yml
(https://github.com/tombreit/mkdocs-pagetree-plugin/blob/main/mkdocs.yml) and the pagetree contains all pages: https://tombreit.github.io/mkdocs-pagetree-plugin/
Do you have a demo repository you could share that demonstrates this behavior?
It's nice plugin. As I look at demo pages, the plugin always renders all pages tree even if it is used in a sub-page. Can I render only children pages or bro-and-children pages tree?