Skip to content

Commit

Permalink
Only include v3 on non-spin docs
Browse files Browse the repository at this point in the history
Signed-off-by: Mikkel Mørk Hegnhøj <mikkel@fermyon.com>

Commenting the code

Signed-off-by: Mikkel Mørk Hegnhøj <mikkel@fermyon.com>
  • Loading branch information
mikkelhegn committed Jan 21, 2025
1 parent 727c6af commit 0110255
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions static/js/src/modules/search.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,16 @@ async function getSearchIndex() {
}
}

//
// This function filters and builds the search index, based on which project is selected (Spin v1, V2, V3, Cloud, Etc.),
//
async function setupSearch() {
documents = await getSearchIndex();
let currentPath = window.location.pathname;
let splitPath = currentPath.split("/");
let version = splitPath[2];
// Adds spin/v1, spin/v2 or spin/v3 based on current path.
// If not on a spin project (e.g., cloud), add spin/v3 (latest)
if (version == "v1") {
documents = documents.filter((k) => {
if (k.project != "spin") {
Expand All @@ -42,12 +47,7 @@ async function setupSearch() {
});
} else {
documents = documents.filter((k) => {
return (
k.project != "spin" ||
!k.url.includes("spin/v1/") ||
!k.url.includes("spin/v2/") ||
!k.url.includes("spin/v3/")
);
return k.project != "spin" || k.url.includes("spin/v3/");
});
}

Expand Down

0 comments on commit 0110255

Please sign in to comment.