Skip to content

Commit

Permalink
fix: make redirection work when page is not existing in previous vers…
Browse files Browse the repository at this point in the history
…ion (#1350)

* fake whitespace for test

* fix: log the redirection url

* fix: remove api

* docs: prevent people from removing the log

* fix: use preventdefault instead of a return statement
  • Loading branch information
12rambau authored Jun 21, 2023
1 parent cb23a7a commit e8d1e68
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/pydata_sphinx_theme/assets/scripts/pydata-sphinx-theme.js
Original file line number Diff line number Diff line change
Expand Up @@ -299,9 +299,8 @@ function checkPageExistsAndRedirect(event) {
location.href = otherDocsHomepage;
});

// this prevents the browser from following the href of the clicked node
// (which is fine because this function takes care of redirecting)
return false;
// ensure we don't follow the initial link
event.preventDefault();
}

/**
Expand Down Expand Up @@ -337,6 +336,7 @@ async function fetchVersionSwitcherJSON(url) {
var versionSwitcherBtns = document.querySelectorAll(
".version-switcher__button"
);

if (versionSwitcherBtns.length) {
const data = await fetchVersionSwitcherJSON(
DOCUMENTATION_OPTIONS.theme_switcher_json_url
Expand Down

0 comments on commit e8d1e68

Please sign in to comment.