lukasgeiter / mkdocs-awesome-pages-plugin

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

Feature Request: Make Directory Titles Clickable to Link Directly to a Specific File #106

Open develmusa opened 2 months ago

develmusa commented 2 months ago

Description:

I would like to request a feature enhancement for the mkdocs-awesome-pages-plugin that allows directory titles in the navigation to be directly clickable and link to a specific Markdown file within that directory.

Current Behavior:

Currently, when using the plugin without defining nav in the mkdocs.yml file, directory titles appear in the navigation, but they are not directly clickable. To achieve a clickable directory title, an index.md file must be added to the directory. However, this approach has limitations:

Proposed Feature:

Introduce an option in the .pages file that allows the directory title to be clickable and link directly to a specific Markdown file (like overview.md) within that directory without requiring an index.md file or manually defining the nav in mkdocs.yml.

For example, in the .pages file:

index: overview.md  # This would make the "Overview" directory
files:
  - setup.md
  - usage.md

Benefits:

lukasgeiter commented 2 months ago

To achieve a clickable directory title, an index.md file must be added to the directory.

That's not actually the default behavior of MkDocs, are you using mkdocs-material and have navigation.indexes turned on by any chance?


In any case, I'm afraid such a feature is out of scope for this plugin. Changing what happens when you click a section depends on the theme and this plugin is purely about creating the navigation structure.

As mentioned above, mkdocs-material has an option to make section headers navigate to the index page, but as far as I can tell it only works with index.md.

An alternative might be mkdocs-section-index. Even though in the documentation they're also using index.md, it seems that it takes the first page in the navigation if it doesn't have a title.