Skip to content

Commit

Permalink
bugfix - switcher link, add version matching, comment out banner
Browse files Browse the repository at this point in the history
  • Loading branch information
BradyPlanden committed Dec 15, 2023
1 parent 1004f76 commit 89cd712
Showing 1 changed file with 19 additions and 2 deletions.
21 changes: 19 additions & 2 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,25 @@

# -- Options for HTML output -------------------------------------------------
# Define the json_url for our version switcher.
json_url = "http://pybop-docs.readthedocs.io/en/latest/_static/switcher.json"
json_url = "https://pybop-docs.readthedocs.io/en/latest/_static/switcher.json"
version_match = os.environ.get("READTHEDOCS_VERSION")
release = f"v{__version__}"

# If READTHEDOCS_VERSION doesn't exist, we're not on RTD
# If it is an integer, we're in a PR build and the version isn't correct.
# If it's "latest" → change to "dev" (that's what we want the switcher to call it)
# Credit: PyData Theme: https://github.com/pydata/pydata-sphinx-theme/blob/main/docs/conf.py
if not version_match or version_match.isdigit() or version_match == "latest":
# For local development, infer the version to match from the package.
if "latest" in release or "rc" in release:
version_match = "latest"
# We want to keep the relative reference if we are in dev mode
# but we want the whole url if we are effectively in a released version
json_url = "_static/switcher.json"
else:
version_match = release
elif version_match == "stable":
version_match = release

html_theme = "pydata_sphinx_theme"
html_show_sourcelink = False
Expand All @@ -72,7 +89,7 @@
"show_prev_next": False,
"navbar_align": "content",
"navbar_center": ["navbar-nav", "version-switcher"],
"show_version_warning_banner": True,
# "show_version_warning_banner": True, # Commented until we have a stable release with docs
"footer_start": ["copyright"],
"footer_center": ["sphinx-version"],
"switcher": {
Expand Down

0 comments on commit 89cd712

Please sign in to comment.