matcornic / hugo-theme-learn

Porting Grav Learn theme to Hugo
https://learn.netlify.com/en/
MIT License
1.6k stars 1.28k forks source link

Avoid expanding submenus #563

Open kmorel opened 2 months ago

kmorel commented 2 months ago

The sidebar menu shows the entire site tree for the selected top level submenu. For sites with a lot of subsites and pages, this makes it much harder to navigate.

This adds a hideExtendedTree site parameters. When set to true, the side menu shows only the most relevant pages: the current page, its ancestors, and their children. The default behavior remains the same, so this modification will not change the behavior of existing pages.

Before

This site has lots of subsites and pages that all show at once.

Screen Shot 2024-06-15 at 7 42 21 PM

After

Once hideExtendedTree = true is added to the site parameters in the configuration, the menu is simplified to this.

Screen Shot 2024-06-15 at 7 42 37 PM

There are at least two active issues asking for this behavior.

Fixes: #511, #88