-
Notifications
You must be signed in to change notification settings - Fork 365
Open
Description
Hi, I'm trying to configure the version switcher, but it's only behaving properly on some pages. When I deactivate the sphinx-tabs extension, all problems vanish. The reason I'm reporting it here instead of there is because I chased the problem to missing DOCUMENTATION_OPTIONS settings, which are controlled here. If it turns out that the pydata theme is trying to write DOCUMENTATION_OPTIONS to index but sphinx-tabs is somehow blocking or overwriting, then I'll go and yell over there :)
What I expected:
- version switcher should populate on all pages for which it is configured in
html_theme_options
What I found:
- version switcher appears but does not populate on the index/home/root page
- version switch does populate correctly on search results page, the generated index/sitemap, and a mystery subset of other pages in a more complex environment than the one I've included below. Oddly it doesn't seem to correspond to whether or not a sphinx-tabs tab appears on the page.
- version switcher misbehavior exactly corresponds to whether or not the page includes
DOCUMENTATION_OPTIONSsettings in the built html
To reproduce:
- Set up a blank sphinx site with the following conf.py:
"""Configuration file for the Sphinx documentation builder."""
project = "version switcher bug"
extensions = [
"sphinx_tabs.tabs",
]
html_theme = "pydata_sphinx_theme"
html_theme_options = {
"switcher": {
"json_url": "https://pydata-sphinx-theme.readthedocs.io/en/latest/_static/switcher.json",
"version_match": "dev"
},
"navbar_start": ["navbar-logo", "version-switcher"],
}
- Build the site and host locally by running
python -m http.server --bind 127.0.0.1 8080from thehtmldirectory - Browse to http://127.0.0.1:8080/index.html
- Observe: version switcher says "Choose version" and no versions are available in the dropdown
- Use the search bar to search any query and view the search results page
- Observe: version switcher says "dev" and many version are available in the dropdown
- Confirm cause of misbehavior by running
find [build_directory] -name "*.html" -exec grep DOCUMENTATION_OPTIONS {} +- Observe:
DOCUMENTATION_OPTIONSis not set in index.html, only in search.html and genindex.html
- Observe:
- Remove the sphinx-tabs extension and rebuild the site
- Observe: version switcher populates correctly on all pages and
DOCUMENTATION_OPTIONSappears in index.html as it should.
- Observe: version switcher populates correctly on all pages and
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels