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

[Doc] Use sphinx-remove-toctrees to generated docstring pages from navigation (and reduce build time) #30021

Open
asfimport opened this issue Oct 25, 2021 · 3 comments

Comments

@asfimport
Copy link
Collaborator

The pydata-sphinx-theme tends to create large trees in the left-side navigation (and thus large generated large html sizes) because sphinx adds all generated docstring pages (from autosummary usage) to the global "toctrees". A small package (https://github.com/executablebooks/sphinx-remove-toctrees/) was created to help with this.

See https://pydata-sphinx-theme.readthedocs.io/en/latest/user_guide/configuring.html#selectively-remove-pages-from-your-sidebar

Reporter: Joris Van den Bossche / @jorisvandenbossche

Note: This issue was originally created as ARROW-14460. Please see the migration documentation for further details.

@asfimport
Copy link
Collaborator Author

Joris Van den Bossche / @jorisvandenbossche:
I tried this out and it works nicely, but it also has a downside of then no longer "highlighting" the parent page in the navigation left-sidebar (which is somewhat annoying for our docs, since the sidebar is quite long and doesn't fit on a single page). See also executablebooks/sphinx-remove-toctrees#1 (comment)

On the other hand, with this change we can remove the if/else in the template here:

{% if "python/api" in pagename or "python/generated" in pagename %}
{{ generate_nav_html("sidebar", startdepth=0, maxdepth=3, collapse=False, includehidden=True, titles_only=True) }}
{% else %}
{{ generate_nav_html("sidebar", startdepth=0, maxdepth=4, collapse=False, includehidden=True, titles_only=True) }}
{% endif %}
(and have it a single generate_nav_html call instead).

@asfimport
Copy link
Collaborator Author

Todd Farmer / @toddfarmer:
This issue was last updated over 90 days ago, which may be an indication it is no longer being actively worked. To better reflect the current state, the issue is being unassigned. Please feel free to re-take assignment of the issue if it is being actively worked, or if you plan to start that work soon.

@AlenkaF
Copy link
Member

AlenkaF commented Jul 12, 2023

I tried this out on the branch with the updated pydata sphinx theme and it works well. The fact that the left sidebar has a missing parent page is a bit confusing but not so much anymore because the parent page is visible in the article header, see:

Screenshot 2023-07-12 at 11 15 54

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants