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

Add option to collapse navbar #748

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

Conversation

cmaureir
Copy link

For large projects, the generation of non-collapsed navbar is frequently a reason for long build periods.

Motivated by the current option available in other themes, like sphinx-book-theme, this patch includes the 'collapse_navbar' option to the theme configuration.

For large projects, the generation of non-collapsed navbar
is frequently a reason for long build periods.

Motivated by the current option available in other
themes, like sphinx-book-theme, this patch includes the
'collapse_navbar' option to the theme configuration.
@cmaureir
Copy link
Author

Hey @pradyunsg 👋

I was trying to implement this with a simple approach, but because the context defined in __init__.py cannot be acceded from the html templates, I was unable to call the furo_navigation_tree with the collapse option.

Naively, I tried to have both function as well defined in the context:

context["furo_navigation_tree"] = _compute_navigation_tree(context)
context["furo_navigation_tree_collapsed"] = _compute_navigation_tree(context, collapse=True)

but of course, that was generating both trees rather than the option selected, so there was no improvement.

The motivation comes from the Qt for Python project, which you might remember uses furo, where we have around 2500 rst files, so with this the sphinx-build process was reduced from 20 minutes, so 2 minutes.

If you believe there is a simpler way to achieve this, I can happily modify the PR :)

Thanks for your time.

@Eric-Arellano
Copy link
Contributor

See #674 for a similar PR and discussion about this topic, including how the Pydata theme recently sped things up in pydata/pydata-sphinx-theme#1609.

@cmaureir
Copy link
Author

Thanks for the insights @Eric-Arellano 🎉 I was following a similar topic from sphinx-book-theme executablebooks/sphinx-book-theme#561 to get the idea for this flag.

At least at the moment we are using this variation and it works well with our documentation process, the speed up is considerable.

@pradyunsg pradyunsg added the configuration Affects one or more configurable behaviours label Apr 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
configuration Affects one or more configurable behaviours
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants