globaltoc_maxdepth
Describe the bug
context
Sphinx 5.3.0
sphinx-book-theme 1.0.1
conf.py:
html_theme = 'sphinx_book_theme'
html_theme_options = {
"globaltoc_maxdepth": 1,
}
expectation
The left sidebar table of contents should be limited to a depth of 1.
bug
The left sidebar table of contents has a depth of 3.
problem
Is the sphinx-book-theme supposed to respect "globaltoc_maxdepth"? Does anyone know how to limit the depth of the left sidebar table of contents?
Reproduce the bug
List your environment
I'm not running jupyter-book, I'm running sphinx-build.
$ sphinx-build --version
sphinx-build 5.3.0
Thanks for opening your first issue here! Engagement like this is essential for open source projects! :hugs:
If you haven't done so already, check out EBP's Code of Conduct. Also, please try to follow the issue template as it helps other community members to contribute more effectively.
If your issue is a feature request, others may react to it, to raise its prominence (see Feature Voting).
Welcome to the EBP community! :tada:
It seems like maybe the left sidebar table of contents maxdepth is hard-coded as 4?
https://github.com/executablebooks/sphinx-book-theme/blob/a9794b73cec766e01bee35a96f7d44e22851f278/src/sphinx_book_theme/theme/sphinx_book_theme/components/sbt-sidebar-nav.html#L18
Maybe I can customize the left sidebar with these instructions. https://github.com/executablebooks/sphinx-book-theme/blob/master/docs/sections/sidebar-primary.md
Ok I got this working. I copyed the file sbt-sidebar-nav.html to a local file sphinx_book_theme_override/sbt-sidebar-nav-override.html and changed it to read maxdepth=2,.
Then in conf.py:
templates_path = ['_templates', './sphinx_book_theme_override']
html_sidebars = {
"**": ["navbar-logo.html", "sbt-sidebar-nav-override.html"]
}
But it would be nice if the sphinx_book_theme respected globaltoc_maxdepth. So I'll leave this issue open.