Closed usulpt closed 11 months ago
I'm assuming the unexpected behavior in your example is that clicking on "Internal Folder" in the navigation expands "Double Internal Folder" as well?
That has nothing to do with awesome-pages. In fact, I would argue it's a bug in mkdocs-material.
To rule out awesome-pages as the cause, I simply hardcoded the navigation that it generates. You can copy the following to the mkdocs.yml
and remove the plugin and you will see that the issue is still present:
nav:
- Home: index.md
- Example:
- Folder:
- folder/index.md
- folder/next.md
- Internal Folder:
- Double Internal Folder:
- folder/internal-folder/double-internal-folder/index.md
- folder/internal-folder/double-internal-folder/internal.md
- folder/internal-folder/double-internal-folder/internal2.md
- Internal File: folder/internal-folder/internal.md
- folder/internal-folder/index.md
For the navigation item of a pruned section such as "Internal Folder", mkdocs-material links to the first child page (recursively). Usually this makes sense, but when combined with the navigation.indexes
feature flag it can lead to this odd behavior.
You can work around this issue by making sure that the index.md
of your section is the first child.
@squidfunk mkdocs-material should probably take navigation.indexes
into account when rendering pruned items.
@usulpt as I said in https://github.com/squidfunk/mkdocs-material/issues/5686#issuecomment-1672655843, you can raise this issue with a minimal reproduction without the awesome-pages plugin, so it's easier for us to observe. What @lukasgeiter says sounds correct, there could be a bug when combining navigation.indexes
with navigation.prune
.
I'm assuming the unexpected behavior in your example is that clicking on "Internal Folder" in the navigation expands "Double Internal Folder" as well?
That has nothing to do with awesome-pages. In fact, I would argue it's a bug in mkdocs-material.
To rule out awesome-pages as the cause, I simply hardcoded the navigation that it generates. You can copy the following to the
mkdocs.yml
and remove the plugin and you will see that the issue is still present:nav: - Home: index.md - Example: - Folder: - folder/index.md - folder/next.md - Internal Folder: - Double Internal Folder: - folder/internal-folder/double-internal-folder/index.md - folder/internal-folder/double-internal-folder/internal.md - folder/internal-folder/double-internal-folder/internal2.md - Internal File: folder/internal-folder/internal.md - folder/internal-folder/index.md
For the navigation item of a pruned section such as "Internal Folder", mkdocs-material links to the first child page (recursively). Usually this makes sense, but when combined with the
navigation.indexes
feature flag it can lead to this odd behavior.You can work around this issue by making sure that the
index.md
of your section is the first child.@squidfunk mkdocs-material should probably take
navigation.indexes
into account when rendering pruned items.
yes, that's the difference in behavior I wasn't expecting and that's exactly what I did, adding the index.md does provide a workaround but the behavior has changed from what I expected and so I decided to let you guys know, sorry if I chose the wrong forum to do it :)
hello! I'm having a weird behavior using awesome pages together with the navigation.prune setting currently available in the beta version (9.2.0b3), where an internal folder is opened when it's parent folder is selected through the menu. I am attaching a minimal example and I have tried the beta version without awesome pages and it's working fine, so I would assume the problem lies with awesome pages :) I have been in contact with the owner of material for mkdocs but I decided to reach out here to make sure the problem is made aware of. thanks in advance! minimal-example.zip