diff --git a/docs/versionwarning.js b/docs/versionwarning.js new file mode 100644 index 00000000000..6e1223d294a --- /dev/null +++ b/docs/versionwarning.js @@ -0,0 +1,47 @@ +(function() { + // adapted from https://scikit-learn.org/versionwarning.js + var latestStable = '10.0.0'; + var showWarning = (msg) => { + $('.bd-header-announcement container-fluid').prepend( + '

' + msg + '

') + }; + if (location.hostname == 'arrow.apache.org') { + var versionPath = location.pathname.split('/')[2]; + if (versionPath == 'developers') { + // developers section in the stable version + showWarning('This is documentation for the stable version ' + + 'of Apache Arrow. For latest contributing practices ' + + 'switch to unstable development ' + + 'release version ' + + latestStable + '.') + } else if (versionPath.match(/^\d/) || location.pathname.split('/')[3] == 'developers') { + // older versions of developers section (with numbered version in the URL) + showWarning('This is documentation for an old release of Apache Arrow ' + + '(version ' + versionPath + '). For latest development practices ' + + 'switch to unstable development release ' + + 'version ' + + latestStable + '.') + } else if (versionPath == 'dev') { + // older versions (with numbered version in the URL) + showWarning('This is documentation for an old release of ' + + 'Apache Arrow (version ' + versionPath + '). Try the ' + + 'latest stable ' + + 'release (version ' + latestStable + ') or ' + + 'development ' + + '(unstable) version.') + } else if (versionPath == 'dev') { + showWarning('This is documentation for the unstable ' + + 'development version of Apache Arrow.' + + 'The latest stable ' + + 'release is version ' + + latestStable + '.') + } + } +})()