-
Notifications
You must be signed in to change notification settings - Fork 36
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
[FR] Extend "flat" to also work with dirs #53
Comments
Thanks for the issue. Although I actually meant your original comment that lists your requirements. |
Also my proposal of the potential solution - if we allow the following syntax: Ad. 1) Here we could go with such nav: nav:
- Projects:
- Project Name:
- projects/project-name/docs | flat or nav:
- Projects:
- Project Name:
- ... | flat | projects/project-name/docs The generated structure should look then this way:
so we avoid redundant Ad. 2) Here we could also reuse the above approach then, so we would define such nav:
- docs | flat
- ... or nav:
- ... | flat | docs
- ... In result we should get the same result as in 1), but with no need to specify the structure manually in This way we also shouldn't break nav definitions from |
@lukasgeiter I know, but actually that comment, and especially point 2), reflects my requirements better than original one 😉 (e.g. I mentioned then that I use Sure, I see, I just haven't seen your comment before posting the above solution proposal. But well, maybe it would become some inspiration for the future implementation 😉 |
Just one more comment for the full context - to achieve the result mentioned in point 1) with current capabilities, we need to do this: nav:
- Home: README.md
- Projects:
- Project Name:
- ... | flat | projects/project-name/docs/*.md
- Subdir:
- ... | flat | projects/project-name/docs/subdir/*.md
- Subdir2:
- ... | flat | projects/project-name/docs/subdir2/*.md
- Subsubdir:
- ... | flat | projects/project-name/docs/subdir2/subsubdir/*.md All above just to avoid |
The new
flat
feature is great, but unfortunately it has some limitations:Project Name
I get one, flat list of pages fromdocs/
and from all subdirs insidedocs/
.However - what If I don't want to flat subdirs? What I mean is - I would like to avoid
Docs
in nav, but I would like to preserve all the subdirs, so I get:And of course the point is not to define all the subdirs manually, but to autogenerate it.
I tested 2 approaches:
Page 1
andPage 2
;Subdir
andPage 3
are not included at all..pages
file insideprojects/project-name/docs/
with various combinations, i.a. withsubdir
specified explicitly:but it didn't have any impact on results - they were exactly the same as before.
.pages
files. I wanted to use such nav in mainmkdocs.yml
:to automatically populate all the projects (actually in that example I don't need to specify
nav
at all to get the same result, but in real-life scenarios I just use it to define the proper order of nav tabs). It works great as it is, but of course then we have unwantedDocs
in nav. My idea was to define.pages
file in each project and specify there to flat the sub-structure to avoidDocs
in nav.I created such
projects/project-name/.pages
file then:but it doesn't work - I get exactly the same results as without the file, so
Docs
stays in nav. I did a few more tests:- ... | flat
- the same result- ... | flat | docs/*
- doesn't work at all, nothing is generated- docs | flat
- returns an error:mkdocs_awesome_pages_plugin.navigation.NavEntryNotFound: Nav entry "docs | flat" not found.
As mentioned by @lukasgeiter in #36:
and that's the reason why it doesn't cover more complicated scenarios, when we actually need to work more with dirs than just pages. That FR is about extending the functionality of
flat
.The text was updated successfully, but these errors were encountered: