Skip to content

Commit df41a7a

Browse files
committed
Use ReadTheDocs variable for version match
1 parent a1bd256 commit df41a7a

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

docs/conf.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,6 @@
2424

2525
import pydata_sphinx_theme
2626

27-
release = pydata_sphinx_theme.__version__
28-
version = release.replace("dev0", "")
2927

3028
# -- General configuration ---------------------------------------------------
3129

@@ -80,10 +78,17 @@
8078
html_theme = "pydata_sphinx_theme"
8179
# html_logo = "_static/pandas.svg" # For testing
8280

83-
if "dev" in release:
84-
version_match = "dev"
81+
# Define the version we use for matching in the version switcher.
82+
if os.environ.get("READTHEDOCS_VERSION"):
83+
# If we detect a READTHEDOCS version, just use this.
84+
version_match = os.environ.get("READTHEDOCS_VERSION")
8585
else:
86-
version_match = "v" + release
86+
# For local development, infer the version to match from the package.
87+
release = pydata_sphinx_theme.__version__
88+
if "dev" in release:
89+
version_match = "latest"
90+
else:
91+
version_match = "v" + release
8792

8893
html_theme_options = {
8994
"external_links": [

0 commit comments

Comments
 (0)