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.
This is a demonstration of allowing users to manually add dropdown links in the header. Currently this PR adds a new configuration value (
dropdown_links
). This takes a list of dictionaries. Each dictionary has aname
, and either has:url
in it, in which case it is treated as an extra top-level link in the header.items
in it, in which caseitems
is treated as a list of links that will populate a dropdown menu.If
url
does not start withhttp
, then we assume it is a document and we resolve it by usingpathto(
In this way, you can add extra items in the header in dropdown menus in order to save space. I also refactored this and the document links into their own templates in case other folks want to over-ride them.
Should this be merged into
extra_links
behavior?Currently,
extra_links
allows users to provide extra top-level links that are "appended" to our site's document tree. We then use then_links_before_dropdown
to automatically create aMore
dropdown when the number of top-level links are above that number.Instead, we could allow
extra_links
to accept the Dropdown configuration provided here (it already accepts a list of dictionaries, so this would only mean supporting theitems
value to add dropdowns). Then,n_links_before_dropdown
would only apply to the site's documents, andextra_links
would be used for any extra links.To do
References
external_links
to be an independent component calledextra_links
#1061