This repository has been archived by the owner on Jul 8, 2021. It is now read-only.
If a menu entry has a page, make it a link even for nested menus. #42
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Currently, a nested menu has grey-and-nonclickable main menu entries in the nav section. This patch allows a "landing page" for such top level menu entries even with nested sections. This landing page could be the front matter of a book, for example (if each top menu entry is a book, and subsections are chapters in that book).
Hugo doesn't allow reverse lookup of urls easily, so it's a bit lame (iterating over $.Site.Pages and accessing the undocumented URLPath). Unfortunately, MenuEntry objects can not be extended either, so there is no simpler solution that I can see.
Example:
And then files:
This would be the preambel of an index file (content/user/00-index.md):
The URL "user" here is matched against the URL in the menu entry. If they are equal, the link is added instead of just the text.
And this the preambel of a chapter: