DOC: add version dropdown to the online doc site (#45370) · pandas-dev/pandas@bc2a383 (original) (raw)

Original file line number Diff line number Diff line change
@@ -225,11 +225,24 @@
225 225 # Theme options are theme-specific and customize the look and feel of a theme
226 226 # further. For a list of options available for each theme, see the
227 227 # documentation.
228 +
229 +switcher_version = version
230 +if ".dev" in version:
231 +switcher_version = "dev"
232 +elif "rc" in version:
233 +switcher_version = version.split("rc")[0] + " (rc)"
234 +
228 235 html_theme_options = {
229 236 "external_links": [],
230 237 "github_url": "https://github.com/pandas-dev/pandas",
231 238 "twitter_url": "https://twitter.com/pandas\_dev",
232 239 "google_analytics_id": "UA-27880019-2",
240 +"navbar_end": ["version-switcher", "navbar-icon-links"],
241 +"switcher": {
242 +"json_url": "https://pandas.pydata.org/versions.json",
243 +"url_template": "https://pandas.pydata.org/{version}/",
244 +"version_match": switcher_version,
245 + },
233 246 }
234 247
235 248 # Add any paths that contain custom themes here, relative to this directory.