Skip to content

Commit dc82965

Browse files
jorisvandenbosschemeeseeksmachine
authored andcommitted
Backport PR pandas-dev#45370: DOC: add version dropdown to the online doc site
1 parent b762af6 commit dc82965

File tree

2 files changed

+43
-0
lines changed

2 files changed

+43
-0
lines changed

doc/source/conf.py

+13
Original file line numberDiff line numberDiff line change
@@ -225,11 +225,24 @@
225225
# Theme options are theme-specific and customize the look and feel of a theme
226226
# further. For a list of options available for each theme, see the
227227
# 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+
228235
html_theme_options = {
229236
"external_links": [],
230237
"github_url": "https://github.com/pandas-dev/pandas",
231238
"twitter_url": "https://twitter.com/pandas_dev",
232239
"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+
},
233246
}
234247

235248
# Add any paths that contain custom themes here, relative to this directory.

web/pandas/versions.json

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
[
2+
{
3+
"name": "dev",
4+
"version": "docs/dev"
5+
},
6+
{
7+
"name": "1.4 (rc)",
8+
"version": "pandas-docs/version/1.4"
9+
},
10+
{
11+
"name": "1.3 (stable)",
12+
"version": "docs"
13+
},
14+
{
15+
"name": "1.3",
16+
"version": "pandas-docs/version/1.3"
17+
},
18+
{
19+
"name": "1.2",
20+
"version": "pandas-docs/version/1.2"
21+
},
22+
{
23+
"name": "1.1",
24+
"version": "pandas-docs/version/1.1"
25+
},
26+
{
27+
"name": "1.0",
28+
"version": "pandas-docs/version/1.0"
29+
}
30+
]

0 commit comments

Comments
 (0)