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

Allow sections to be configured in nav #30

Closed
athal7 opened this issue Oct 6, 2020 · 8 comments
Closed

Allow sections to be configured in nav #30

athal7 opened this issue Oct 6, 2020 · 8 comments
Labels
enhancement New feature or request

Comments

@athal7
Copy link

athal7 commented Oct 6, 2020

In order to achieve top-level sections (e.g. to utilize material navigation tabs), I need to either:

  • use this plugin but restructure all of my docs based on those sections
  • use the native mkdocs nav functionality, and miss out on the good features here including the spread operator for the "rest" of the pages

It would be great to be able to specify custom sections in the .pages file of the docs_dir, e.g.:

nav:
  - Vision:
    - principles.md
    - roadmap.md
  - People:
    - team.md
    - advisors.md
  - ...
@lukasgeiter
Copy link
Owner

lukasgeiter commented Oct 6, 2020

Restructuring your docs actually sounds like a good idea to me. Can you help me understand why you don't want to go that route?
Of course I understand that there is some work involved, but I would think that it should be quite easy to move a few files into folders and update any links if necessary. Plus you'll end up with a better organized file structure.

@athal7
Copy link
Author

athal7 commented Oct 6, 2020

Users have bookmarked some of the pages, and I’m not 100% sure this is the final organization, so I don’t want to setup redirects potentially multiple times

@athal7
Copy link
Author

athal7 commented Oct 7, 2020

Looking at trying to implement this, I can see why there's some hesitation @lukasgeiter :). Some abstractions in the test setup around asserting section children have the section as the parent and some of the assumptions in MetaNavItem may make this request challenging to fulfill.

@lukasgeiter
Copy link
Owner

The implementation is only part of why I'm hesitant. Your request somewhat goes against the core idea of the .pages file. Which is configuring the navigation at the folder level.

I think a better idea for you might be to add support for an ... entry to nav in mkdocs.yml. I'll look into the feasibility of such a feature and get back to you soon.

@athal7
Copy link
Author

athal7 commented Oct 7, 2020

good thinking, and thanks!

@lukasgeiter
Copy link
Owner

Good news! I did some quick tests and should be possible. Here's how it's going to work:

If a ... entry is present, the plugin generates a second navigation tree based off the file structure. All pages explicitly mentioned in nav are removed from this navigation tree before it is inserted in place of the ... entry.

It's going to take me a bit of time to properly implement and test this. I'll let you know once the release is out.

@lukasgeiter lukasgeiter added the enhancement New feature or request label Oct 8, 2020
@lukasgeiter
Copy link
Owner

I've just released v2.4.0 with this feature. Check out the updated README for all the details.

@athal7
Copy link
Author

athal7 commented Oct 15, 2020

Works great, thank you @lukasgeiter!

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

No branches or pull requests

2 participants