Skip to content

Commit

Permalink
Fix search URLs
Browse files Browse the repository at this point in the history
  • Loading branch information
dlesbre committed Apr 26, 2024
1 parent a59966a commit 78ac5a3
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion odoc.support/odoc_search.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,15 @@ document.querySelector(".search-bar").addEventListener("focus", (ev) => {
let f = (entry) => {
let search_result = document.createElement("a");
search_result.classList.add("search-entry");
search_result.href = base_url + entry.url;
// MANUAL EDIT: change the URL to match our scheme:
// ie. no package level in URL, instead replace it with a version level
// See https://github.com/art-w/sherlodoc/issues/41 for a discussion on this
search_result.href =
// removing leading "../" that would take us back to the package level
// The url is instead relative to the library toplevel
base_url.replace(/^\.\.\//, "") +
// Removing package-name from full URL (given relative to the package level)
entry.url.replace(/^patricia\-tree\//, "");
search_result.innerHTML = entry.html;
search_results.appendChild(search_result);
};
Expand Down

0 comments on commit 78ac5a3

Please sign in to comment.