preselect search version filters
This commit is contained in:
parent
8af645c093
commit
940e9e3f2c
1 changed files with 8 additions and 1 deletions
|
|
@ -133,7 +133,10 @@ import magnifierIcon from "@icons/magnifier.svg?raw";
|
||||||
//@ts-expect-error
|
//@ts-expect-error
|
||||||
"@pagefind/default-ui"
|
"@pagefind/default-ui"
|
||||||
);
|
);
|
||||||
new PagefindUI({
|
const versionMatch = window.location.pathname.match(/^\/docs\/([^/]+)/);
|
||||||
|
const activeVersion = versionMatch?.[1];
|
||||||
|
|
||||||
|
const search = new PagefindUI({
|
||||||
element: "#qs_search",
|
element: "#qs_search",
|
||||||
// resetStyles: false,
|
// resetStyles: false,
|
||||||
sort: { version: "desc" },
|
sort: { version: "desc" },
|
||||||
|
|
@ -170,6 +173,10 @@ import magnifierIcon from "@icons/magnifier.svg?raw";
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (activeVersion) {
|
||||||
|
search.triggerFilters({ version: activeVersion });
|
||||||
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue