Skip to content

Add dropdown menus to horizontal navbar #225

Open
svekars wants to merge 6 commits intopytorch_sphinx_theme2from
add-dropdown-support
Open

Add dropdown menus to horizontal navbar #225
svekars wants to merge 6 commits intopytorch_sphinx_theme2from
add-dropdown-support

Conversation

@svekars
Copy link
Contributor

@svekars svekars commented Feb 3, 2026

Adds dropdown menus to horizontal navbar items that have child pages. When hovering over these items on desktop, a dropdown displays (from the underlying toctree) the sub-pages for quick navigation.

  • Custom navbar-nav.html template that generates hierarchical navigation from toctree structure
  • Python functions in __init__.py to extract toctree children using toctree_includes
  • CSS styles in _navbar_dropdown.scss for hover-based dropdowns

Features:

  • Desktop: Hover to show dropdown with child pages, click parent link to navigate
  • Mobile: Dropdowns hidden, parent link navigates to page directly
  • Scrollable dropdown for long lists (max-height: 70vh)
  • Respects header_links_before_dropdown config for "More" button
  • Pure CSS/Jinja implementation, no additional JavaScript
  • Enabled by default, can be disabled by setting html_theme_options: "enable_navbar_dropdowns": False

@netlify
Copy link

netlify bot commented Feb 3, 2026

Deploy Preview for pytorchsphinxtheme ready!

Name Link
🔨 Latest commit 9c6d28f
🔍 Latest deploy log https://app.netlify.com/projects/pytorchsphinxtheme/deploys/69850bbbe8c1320008ecaa3f
😎 Deploy Preview https://deploy-preview-225--pytorchsphinxtheme.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@meta-cla meta-cla bot added the cla signed label Feb 3, 2026
@svekars svekars force-pushed the add-dropdown-support branch from 34a8679 to 0f16517 Compare February 4, 2026 21:40
@svekars svekars changed the title Adding PyTorch Sphinx theme 2 Add dropdown menus to horizontal navbar Feb 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant