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

NEW: Dropdown links in header #1165

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

choldgraf
Copy link
Collaborator

@choldgraf choldgraf commented Feb 7, 2023

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 a name, and either has:

  1. url in it, in which case it is treated as an extra top-level link in the header.
  2. items in it, in which case items is treated as a list of links that will populate a dropdown menu.

If url does not start with http, then we assume it is a document and we resolve it by using pathto(

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 the n_links_before_dropdown to automatically create a More 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 the items value to add dropdowns). Then, n_links_before_dropdown would only apply to the site's documents, and extra_links would be used for any extra links.

To do

  • Answer question above
  • Agree on config and UX
  • Add tests
  • Document

References

@trallard trallard added the kind: enhancement New feature or request label Feb 5, 2024
@Carreau
Copy link
Collaborator

Carreau commented May 22, 2024

One of the issue is that this is also used in the sidebar when generating navigation, so we also need to design how it would look like there. And more generally, if we allow one level of nesting why note more, in which case we get a full-menu.

But I see where you are going here.

@choldgraf
Copy link
Collaborator Author

Feel free to take this one over and/or totally rework it @Carreau - I won't have time to get it over the finish line.

@Carreau
Copy link
Collaborator

Carreau commented May 27, 2024

Thanks @choldgraf It's on my todo list, but bugfixes first.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind: enhancement New feature or request
Projects
None yet
3 participants