From b05afbdd08e1f64caaf6d2c048da316c6d4d85ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ji=C5=99=C3=AD=20Fiala?= Date: Wed, 3 Feb 2021 15:09:26 +0100 Subject: [PATCH] search: OKD4 version and URL workaround * Avoids the current OKD 4 docs and URL discrepancy where the version is set to 4, but the URL contains the "latest" string instead that filters all results with the URL string "/4/" that is never present. * If future "latest" versions would be represented by other version values, this needs to be adjusted accordingly. * Closes #28979 Signed-off-by: Jiri Fiala --- _javascripts/hc-search.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/_javascripts/hc-search.js b/_javascripts/hc-search.js index 1271a6d741..d8b47e1424 100644 --- a/_javascripts/hc-search.js +++ b/_javascripts/hc-search.js @@ -27,6 +27,8 @@ function hcSearchCategory(label, version) { label: label, urlFilter: (typeof version === "undefined" || version == "Branch Build") ? "" : (" url:*\\/" + version.toLowerCase() + "\\/*") }; + // work around the current OKD-specific version=4 and URL discrepancy + if (window.location.href.includes("docs.okd.io/latest/") && version == 4) searchParams.urlFilter = " url:*\\/latest\\/*" modalSearch.show(); hcsearch(searchParams); }