Skip to content

Commit

Permalink
Improve version selector for local doc
Browse files Browse the repository at this point in the history
  • Loading branch information
kwankyu committed Jul 2, 2024
1 parent e01bc4e commit ed0c21e
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/doc/common/static/jupyter-sphinx-furo.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,14 @@ function changeVersion() {
let selected_url = select_element.value;
if (selected_url) {
if (window.location.protocol == 'file:') {
window.location.href = selected_url + 'html/en/index.html';
let pathname = window.location.pathname;
let cutoff_point = pathname.indexOf('doc/sage');
if (cutoff_point !== -1) {
pathname = pathname.substring(cutoff_point + 8);
window.location.href = selected_url + pathname;
} else {
window.location.href = selected_url + 'html/en/index.html';
}
} else {
window.location.href = selected_url + window.location.pathname;
}
Expand Down

0 comments on commit ed0c21e

Please sign in to comment.