Skip to content

Commit 26caf95

Browse files
committed
Add workaround for theme versions that don't support mode switcher.
1 parent a194b5b commit 26caf95

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

doc/conf.py

+10-1
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,17 @@
8383
html_theme_options = {
8484
"github_url": "https://github.com/numpy/numpydoc",
8585
"show_prev_next": False,
86-
"navbar_end": ["theme-switcher", "search-field.html", "navbar-icon-links.html"],
86+
"navbar_end": ["search-field.html", "navbar-icon-links.html"],
8787
}
88+
# Add version switcher for versions of pydata_sphinx_theme that support it
89+
import packaging
90+
import pydata_sphinx_theme
91+
92+
if packaging.version.parse(pydata_sphinx_theme.__version__) >= packaging.version.parse(
93+
"0.9.0"
94+
):
95+
html_theme_options["navbar_end"].insert(0, "theme-switcher")
96+
8897
html_sidebars = {
8998
"**": [],
9099
}

0 commit comments

Comments
 (0)