-
Notifications
You must be signed in to change notification settings - Fork 37
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
Requesting more features for hide #35
Comments
That's actually how nav:
- index.md |
But while having |
Yes that's true, but if you want to include only I think I might not understand your situation fully. Could you post an example? |
I might be misunderstanding how
The generated nav list takes
BTW, i am using the material theme, perhaps it is a theme issue? I just want to drop the
The |
Let's see what mkdocs original nav:
- Home: index.md
- subdir/index.md
- subsubdir/index.md It generates what I want, three items containing the title of the Given nav structure with explicit section definition: nav:
- Home: index.md
- Subdir:
- subdir/index.md
- Subsubdir:
- index.md then nav:
- index.md
- Subsubdir: # explicit section
- subsubdir # directory to load I've learnt that I misused the |
Thanks for the examples. I'm getting a clearer picture now. However there is one thing I don't understand...
What exactly do you mean by are not built into the site? As far as I'm aware, MkDocs still includes files under |
Yes, it does. It always build all files and place the html pages in the I am using Material theme's navigation tabs and awesome-pages plugin, not After digging a bit more:
My expectation is to have fine control over directories, letting them handled as same as regular files. That is, if no explicit section keys are given to a directory in |
Okay now I think I fully understand your problem. Unfortunately I'm not sure I can help you with it. You see, this plugin works by modifying MkDocs data structure storing the navigation tree. It makes it easier to customize the navigation without manually listing every file in To render the active navigation entries for a page, MkDocs navigates from the page upwards in the navigation tree and marks all parents as active as well. But if the page is not in the tree, there are no parents to mark as active. Right now I can't think of any way to achieve your desired result. I also don't see a way that my plugin could be augmented to do so. In order to support existing themes I have to stick to the MkDocs API which, as far as I can tell, simply doesn't account for pages to be hidden from the navigation in this way. I believe this would have to be addressed in either MkDocs, the theme or both. |
I started using mkdocs for one of my doc project some day ago and encountered very similar issue as yours. As a Sphinx user I think I exactly understand what you mean. That is, directories are just for organizing files and never should be used as a context for producing navigation (global toc). As you mentioned, taking subdirectories as sections is actually a behavior of mkdocs itself, this plugin doesn't break the rule. If you stick to a certain theme for your project that has a specific directory structure, it would be better to tweak the theme's templates. But mkdocs doesn't provide enough template variables for tweaking, so for complicated features you may have to write our own plugin. |
No pages need to to removed, he only wants the sections (not pages) generated from the subdirectories to be removed. A section links to nothing but just groups all the pages belonging to it. What he wants is if I didn't specify a section name for a directory, do not generate this section, but just load all files from it. The navigation may be like as below with a certain theme
Note that the
Now he wants:
no section marker at all. |
@madjxatw I don't think that's what @idnsunset wants. Here's an excerpt from the opening comment (emphasis mine):
I'd prefer if you left explaining what @idnsunset wants to them. Of course you're welcome to contribute your own ideas and suggestions for a solution though. If the feature you're describing is something you want, please create a separate issue for it. |
I need the same feature as he does. I only need pages from a directory but don't want any directory to produce section in the navigation, unless I specifically request one. I work this around by tweaking a certain theme, though it is not a common approach, as this should have be done inside mkdocs itself. |
@idnsunset actually misused the |
Could i request another feature for hide? I mean i want to hide section or say a folder from navigation in the header but i also want to be able to access that page with its contents if i know the link. Example i have:
And i want to hide subsubdir22 from main navigation in the header, but i want to open the subsubdir22 link (knowing it in advance, like put a hidden button somewhere in the page) and see all the contents of subsubdir22 and subsubdir222 in the navigation or toc so that i could navigate using generated toc. |
I agree that this type of feature would be helpful, as I'm using Netify-CMS ontop of mkdocs material, but setting the page to |
I second this feature request about andwejsp, maybe we shall create a separate feature request ? |
@Noobzik Yes, a separate feature request would make sense! Please also include what problem you're trying to solve 🙂 |
I've seen that a
.pages
containinghide: true
can have the entire directory hidden in the navigation. However, I often would prefer to hide a part of files in a directory. For example with a directory in which I have too many files that would make the navigation list way too long, so we would put aindex.md
file to well organize them and only have theindex.md
listed in the navigation while hiding all others.I hope the plugin could hide all files that are not listed in the
nav
instead of the whole directory.The text was updated successfully, but these errors were encountered: