Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Full custom nav for pages in a directory #88

Open
craigbox opened this issue Oct 2, 2023 · 1 comment
Open

Full custom nav for pages in a directory #88

craigbox opened this issue Oct 2, 2023 · 1 comment

Comments

@craigbox
Copy link

craigbox commented Oct 2, 2023

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
Copy link
Owner

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants