|
4 | 4 | # https://www.sphinx-doc.org/en/master/usage/configuration.html |
5 | 5 |
|
6 | 6 | from datetime import date |
| 7 | +import os |
7 | 8 | import sys |
8 | 9 | from pathlib import Path |
9 | 10 |
|
|
124 | 125 |
|
125 | 126 | html_css_files = ["theme_overrides.css", "custom.css"] |
126 | 127 |
|
| 128 | +# All doc versions fetch this URL so old builds pick up new tags. |
| 129 | +# READTHEDOCS_VERSION is "latest", "stable", or the git tag (e.g. 0.4.55). |
| 130 | +_switcher_json = ( |
| 131 | + "https://pysdkit.readthedocs.io/en/latest/_static/version_switcher.json" |
| 132 | +) |
| 133 | +_version_match = os.environ.get("READTHEDOCS_VERSION") or "latest" |
| 134 | + |
127 | 135 | html_theme_options = { |
128 | 136 | "announcement": "", |
129 | 137 | "logo": { |
130 | 138 | "image_light": "_static/logo.png", |
131 | 139 | "image_dark": "_static/logo.png", |
132 | | - "text": "PYSDKIT", |
| 140 | + "text": "PySDKit", |
133 | 141 | "alt_text": "PySDKit", |
134 | 142 | "link": "https://pysdkit.readthedocs.io/", |
135 | 143 | }, |
| 144 | + "switcher": { |
| 145 | + "json_url": _switcher_json, |
| 146 | + "version_match": _version_match, |
| 147 | + }, |
| 148 | + # First deploy of the JSON on latest would otherwise fail the check. |
| 149 | + "check_switcher": False, |
| 150 | + "show_version_warning_banner": True, |
136 | 151 | "header_links_before_dropdown": 6, |
137 | 152 | "icon_links": [ |
138 | 153 | { |
|
151 | 166 | "navbar_align": "content", |
152 | 167 | "navbar_start": ["navbar-logo"], |
153 | 168 | "navbar_center": ["navbar-nav"], |
154 | | - "show_version_warning_banner": False, |
| 169 | + "navbar_end": ["version-switcher", "theme-switcher", "navbar-icon-links"], |
155 | 170 | "secondary_sidebar_items": { |
156 | 171 | "**": ["page-toc", "sourcelink"], |
157 | 172 | }, |
|
0 commit comments