lukasgeiter / mkdocs-awesome-pages-plugin

An MkDocs plugin that simplifies configuring page titles and their order
MIT License
452 stars 35 forks source link

Full custom nav for pages in a directory #88

Open craigbox opened 9 months ago

craigbox commented 9 months ago

I have an mkdocs site with a defined nav: set up in mkdocs.yml. This is working well on all the documentation and blog pages we have so far.

I want to add some reference categories, which will contain >200 reference documents. I don't want to list all of these in the main nav, but I would like it that when you are in that section, there is a navigation which is dynamically generated and only lists the documents in that section.

For example, assume I have

/docs/controls/index.md
/docs/controls/c-0001.md
/docs/controls/c-0002.md
/docs/controls/c-0003.md
...
/docs/controls/c-0250.md

When I'm on /docs/controls/ or any of the specific control URLs underneath, I'd like the nav to look like

Controls C-0001 C-0002 C-0003 .. C-0250

and not have any other nav elements displayed.

Is there a way to do that with this plugin, or can you think of another way I might achieve this?

Thanks!

lukasgeiter commented 9 months ago

That is currently not possible using this plugin. The navigation is currently generated once and used for all pages. Building some pages with a different navigation should be technically possible but I can't promise that I'll ever implement such a feature. If you want to try this on your own, I can think of two approaches:

  1. Create your own plugin (I would start with trying to modify the navigation in the on_page_context event)
  2. Build the reference pages as a second mkdocs site and add a link to it in the main navigation