Closed Charlie-XIAO closed 5 months ago
So the problem seems to be here:
When secondary_sidebar_items
is a dictionary, even if for this page we have an empty list not theme_secondary_sidebar_items
will evaluate the whole dictionary and thus is false. We should alternatively use secondary_sidebar_items
which is an array set by set_secondary_sidebar_items()
in utils.py
, as is done in sidebar-secondary.html
. I opened #1688 for this, together with a test.
From the documentation there are two ways to remove the secondary sidebar from a page: via page-wide metadata
:html_theme.sidebar_secondary.remove:
or viahtml_theme_options
inconf.py
and set the"secondary_sidebar_items"
for a particular page into an empty list. However, they do not seem to behave consistently. In particular, when removing via conf (e.g. https://pydata-sphinx-theme.readthedocs.io/en/latest/examples/no-sidebar.html) the secondary sidebar actually still exists and takes up width, though empty. When removing via page-wide metadata (e.g. https://pydata-sphinx-theme.readthedocs.io/en/latest/examples/in-page-toc.html) the secondary sidebar is completely removed.I also constructed minimal reproducible examples here. You may compare these two pages:
https://charlie-xiao.github.io/pst-testing-website-0-15-2/issue-1686/remove_with_conf.html https://charlie-xiao.github.io/pst-testing-website-0-15-2/issue-1686/remove_with_meta.html