Skip to content

DOC: add version dropdown to the online doc site #45370

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jan 18, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions doc/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -225,11 +225,24 @@
# Theme options are theme-specific and customize the look and feel of a theme
# further. For a list of options available for each theme, see the
# documentation.

switcher_version = version
if ".dev" in version:
switcher_version = "dev"
elif "rc" in version:
switcher_version = version.split("rc")[0] + " (rc)"

html_theme_options = {
"external_links": [],
"github_url": "https://github.com/pandas-dev/pandas",
"twitter_url": "https://twitter.com/pandas_dev",
"google_analytics_id": "UA-27880019-2",
"navbar_end": ["version-switcher", "navbar-icon-links"],
"switcher": {
"json_url": "https://pandas.pydata.org/versions.json",
"url_template": "https://pandas.pydata.org/{version}/",
"version_match": switcher_version,
},
}

# Add any paths that contain custom themes here, relative to this directory.
Expand Down
30 changes: 30 additions & 0 deletions web/pandas/versions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
[
{
"name": "dev",
"version": "docs/dev"
},
{
"name": "1.4 (rc)",
"version": "pandas-docs/version/1.4"
},
{
"name": "1.3 (stable)",
"version": "docs"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the difference between this (stable) and pandas-docs/version/1.3?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, not fully sure about this. So the difference is the exact url. The stable one links to https://pandas.pydata.org/docs/, while the other links to https://pandas.pydata.org/pandas-docs/version/1.3/.

Currently, that's both linking to the exact same docs (for 1.3.5). But once 1.4.0 is out, the https://pandas.pydata.org/docs/ will start pointing to the 1.4 docs.

So if we don't yet add this 1.3 specific entry, that means you can't (from this menu) get to a page / link that will always keep linking to the 1.3 docs.
Now, that's maybe not too important to be able to do, so we could also leave it out (and only add the version-specific entry once the next stable release is out)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah okay so it sounds like "latest released" vs a specific version.

I would be partial just to have links to specific versions and not necessarily https://pandas.pydata.org/docs/ but not a super strong opinion of mine.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO I would include a link to the stable (https://pandas.pydata.org/docs/) docs. That is (or should be) the most used documentation version, and so I think it is good to have an explicit link to that from the older versions.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Linking to the stable docs sounds good.

},
{
"name": "1.3",
"version": "pandas-docs/version/1.3"
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Question: is there any preference in showing the fully qualified version ("1.3.5"), or rather a simplified one ("1.3") ?
Also referring to django (https://docs.djangoproject.com/), for example they show the simplified version

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i would just show the minor version e.g. 1.3

},
{
"name": "1.2",
"version": "pandas-docs/version/1.2"
},
{
"name": "1.1",
"version": "pandas-docs/version/1.1"
},
{
"name": "1.0",
"version": "pandas-docs/version/1.0"
}
]