lukasgeiter / mkdocs-awesome-pages-plugin

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

Allow creation of new (virtual) section from .pages #59

Closed dimrozakis closed 2 years ago

dimrozakis commented 2 years ago

Allows the nav config of .pages to create new sections to organize pages.

Fixes #37

dimrozakis commented 2 years ago

Hi @lukasgeiter

I created this PR because I wanted to reorganize the pages in a more nested hierarchy without changing their paths (and their links). This is working properly for me in the site I'm managing. All preexisting tests pass and I've added a couple of new tests for the new functionality.

Some notes:

  1. I'm not very familiar with mkdocs-awesome-pages-plugin. This was a quick implementation which I'm sure could be improved upon. I'm not sure if you're happy with the use of nested functions. Or the term "virtual" section. Feel free to make suggestions or direct edits.
  2. As previously said, this is working for me and all preexisting and new tests pass, but I haven't covered every possible use case in the tests. For example I don't test nested "virtual" sections. Or what happens if a virtual section has the same name as a real section. I can't 100% guarantee that this works properly in combination with every other feature of the plugin.
  3. I haven't documented this feature in the README.
  4. I'm not sure but I think that this can also satisfy the use case of https://github.com/lukasgeiter/mkdocs-awesome-pages-plugin#combine-custom-navigation--file-structure with a top level .pages instead of defining the nav section in mkdocs.yml.

Looking forward to your feedback. And thanks for creating this plugin.

lukasgeiter commented 2 years ago

Hey @dimrozakis

Thanks for the PR! Right now I'm a bit short on time, but I'll take a closer look in the coming days.

dimrozakis commented 2 years ago

@lukasgeiter thanks for the review. I've addressed all your comments. Any thoughts on points 2,3,4 from https://github.com/lukasgeiter/mkdocs-awesome-pages-plugin/pull/59#issuecomment-1021559894?