lukasgeiter / mkdocs-awesome-pages-plugin

An MkDocs plugin that simplifies configuring page titles and their order
MIT License
472 stars 36 forks source link

Hide entire menu with an `hide-menu: true` setting in .pages file #23

Closed kleinen closed 4 years ago

kleinen commented 4 years ago

My group has some theme overrides setup to not render the entire nav menu of our main index page since we want the main page to be clean and the other pages are more "utility" in nature. It would be nice if this were built-in and we didn't need the custom theme work.

It feels like this functionality best fits with this plugin, hence why this enhancement suggestion was created.

lukasgeiter commented 4 years ago

I'm not sure if I fully understand your request. Would this be different than setting hide: true in the .pages file of the parent folder?

kleinen commented 4 years ago

Well there you go being awesome. I hadn't thought of that. I'll give it a try.

kleinen commented 4 years ago

No luck. I get an warning. I think it has to do with the menu I'm hiding being the root page menu.

[I 200427 18:28:34 watcher:103] Running task: builder (delay: None)
INFO    -  Running task: builder (delay: None)
INFO    -  Building documentation... 
/usr/local/lib/python3.8/site-packages/mkdocs_awesome_pages_plugin/navigation.py:48: HideInRootHasNoEffect: Using the "hide" attribute in the .pages file of the doc root has no effect
  warnings.warn(HideInRootHasNoEffect(self.options.filename))
lukasgeiter commented 4 years ago

Do you want to hide the navigation for all pages or only when the root page is selected?

kleinen commented 4 years ago

Only when the root page is selected. Now that I type that, maybe this plugin is not the place for that and it would best be something added directly into mkdocs-material or its own extension/plugin.

Do you think this would be something that would be covered through this plugin?

lukasgeiter commented 4 years ago

I think you're probably right. This plugin currently only hooks into the on_nav event which is only called once for the entire build. I'm not even sure if it would be possible to change the navigation based on the selected page using a mkdocs plugin.

As far as I can tell, the right place to implement such a feature would be the theme.