Skip to content

Script to warn when viewing version other than stable #13

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
Aug 12, 2019
Merged
Changes from 1 commit
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
Prev Previous commit
Improvements to wording (some due to reviews)
  • Loading branch information
jnothman authored Aug 12, 2019
commit a7a540a2db9816dd25591ba2f23405f1020ab128
19 changes: 11 additions & 8 deletions versionwarning.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
(() => {
(function() {
var latestStable = '0.21';
var goodPaths = ['stable', 'dev', latestStable];
var showWarning = (msg) => {
Expand All @@ -16,16 +16,19 @@
if (___location.hostname == 'scikit-learn.org') {
var versionPath = ___location.pathname.split('/')[1];
if (!goodPaths.includes(versionPath)) {
showWarning('You are looking at documentation for an old release of ' +
showWarning('This is documentation for an old release of ' +
'Scikit-learn (version ' + versionPath + '). Try the ' +
'<a href="https://scikit-learn.org">latest release</a> or ' +
'<a href="https://scikit-learn.org">latest stable ' +
'release</a> (version ' + latestStable + ') or ' +
'<a href="https://scikit-learn.org/dev">development</a> ' +
Copy link
Member

Choose a reason for hiding this comment

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

I am not sure for putting the dev on outdated versions. Few users need it and it can lead to confusion.

Copy link
Member

Choose a reason for hiding this comment

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

hmm, the dev version would be nice if we also tell people that they can have it through the nightly wheels. We would also get more testers before the release that way. I wouldn't mind that.

Copy link
Member Author

Choose a reason for hiding this comment

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

Do you mean that the warning shown on dev should point the user to installation instructions? Nice idea

Copy link
Member

Choose a reason for hiding this comment

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

I agree with @rth about not strictly encouraging the dev docs. Maybe we can make it clearer with

Try the latest stable release (recommended) or the development version (unstable).

And yes linking to installation instructions on the dev version would be great too

'versions.')
'(unstable) versions.')
} else if (versionPath == 'dev') {
showWarning('You are looking at documentation for the unstable ' +
'development version of Scikit-learn. See also the ' +
'<a href="https://scikit-learn.org">latest release</a> ' +
'version.')
showWarning('This is documentation for the unstable ' +
'development version of Scikit-learn. (To use it, ' +
'<a href="https://scikit-learn.org/stable/developers/advanced_installation.html#installing-nightly-builds">install the nightly build</a>.) ' +
'The latest stable ' +
'release is <a href="https://scikit-learn.org">version ' +
latestStable + '</a>.')
}
}
})()