Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
develmusa opened this issue Sep 10, 2024 · 1 comment

Comments

@develmusa
Copy link

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:

  • An index.md file may interfere with existing wikilinks or other internal linking structures.
  • It results in both the directory title and the specific file (e.g., overview.md) being listed separately in the navigation.

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:

  • Provides greater flexibility and control over the navigation structure.
  • Simplifies navigation configuration, particularly for users who rely on the automatic generation of navigation.
  • Avoids redundant entries and improves usability when organizing content.

Use Case Example:

Given a structure like:

docs/
├── index.md
└── overview/
   ├── .pages
   ├── overview.md
   ├── setup.md
   └── usage.md

I would like the "Overview" title in the navigation to be clickable and link directly to overview.md without needing an index.md file and without explicitly defining the nav in mkdocs.yml.

@lukasgeiter
Copy link
Owner

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants