1
0
mirror of https://github.com/minio/docs.git synced 2025-08-08 01:43:18 +03:00

Update search configs to return only community docs hits (#1488)

This commit is contained in:
Rushan
2025-07-31 18:48:35 +05:30
committed by GitHub
parent 2a81b07c24
commit c400a42221
3 changed files with 8 additions and 90 deletions

View File

@@ -3,11 +3,6 @@ window.addEventListener("DOMContentLoaded", () => {
const searchModalEl = document.getElementById("search");
const root = document.documentElement;
// Get the current doc platform
const activePlatform = document
.getElementsByTagName("meta")
["docsearch:platform"].getAttribute("content");
// Set search page title
// TODO: Do the right way
const pageName = document
@@ -103,8 +98,8 @@ window.addEventListener("DOMContentLoaded", () => {
initialUiState: {
minio: {
refinementList: {
platform: [activePlatform],
site: "docs"
site: "docs",
edition: "community",
},
},
},
@@ -128,17 +123,6 @@ window.addEventListener("DOMContentLoaded", () => {
if (query !== "") {
// Make search modal active
searchModalEl.classList.add("search--focused");
// Clear the filters and select the active platform
setTimeout(() => {
const activeFilterEl = document.querySelector(
".search__filters__checkbox[value='" + activePlatform + "']"
);
if (activeFilterEl && !activeFilterEl.checked) {
activeFilterEl.click();
}
}, 50);
} else {
// Clear the filters
clearRefinements();
@@ -201,7 +185,6 @@ window.addEventListener("DOMContentLoaded", () => {
</i>
<div class="search__hits__text">
<div class="search__hits__title">${data._highlightResult.hierarchy.lvl1.value}</div>
<div class="search__hits__platform">${data.platform}</div>
</div>
`;
}
@@ -219,7 +202,6 @@ window.addEventListener("DOMContentLoaded", () => {
<div class="search__hits__text">
<div class="search__hits__title">${data._highlightResult.hierarchy.lvl2.value}</div>
<div class="search__hits__label">
<div class="search__hits__platform">${data.platform}</div>
${data.hierarchy.lvl1}
</div>
</div>
@@ -239,7 +221,6 @@ window.addEventListener("DOMContentLoaded", () => {
<div class="search__hits__text">
<div class="search__hits__title">${data._highlightResult.hierarchy.lvl3.value}</div>
<div class="search__hits__label">
<div class="search__hits__platform">${data.platform}</div>
${data.hierarchy.lvl1}
</div>
</div>
@@ -262,7 +243,6 @@ window.addEventListener("DOMContentLoaded", () => {
data._snippetResult.content.value
}</div>
<div class="search__hits__label">
<div class="search__hits__platform">${data.platform}</div>
${data.hierarchy.lvl1}
${
data.hierarchy.lvl2
@@ -374,24 +354,9 @@ window.addEventListener("DOMContentLoaded", () => {
if (e.key === "Enter") {
const searchInputEl = document.querySelector(".search__input");
if (searchInputEl.value && document.activeElement === searchInputEl) {
var platform = "";
var environment = location.hostname === "localhost" || location.hostname === "127.0.0.1" ? "dev" : "prod";
if (activePlatform === "k8s") {
platform = "kubernetes/upstream";
} else if (activePlatform === "openshift") {
platform = "kubernetes/openshift";
} else if (activePlatform === "eks") {
platform = "kubernetes/eks";
} else if (activePlatform === "gke") {
platform = "kubernetes/gke";
} else if (activePlatform === "aks") {
platform = "kubernetes/aks";
} else {
platform = activePlatform;
}
var pathname = environment === "dev" ? "/search.html" : `/docs/minio/${platform}/search.html`;
var pathname = environment === "dev" ? "/search.html" : `/docs/minio/search.html`;
setTimeout(() => {
window.location.pathname = pathname;

View File

@@ -98,6 +98,10 @@
&::placeholder {
color: var(--text-muted-color);
}
&:focus {
border-color: darken($neutral-subtle, 5%);
}
}
.search__reset {
@@ -276,17 +280,10 @@
vertical-align: middle;
color: var(--text-muted-color);
font-size: 0.65rem;
/* display: flex;
align-items: center; */
line-height: 1;
//margin-top: 0.35rem;
min-height: 1rem;
padding-bottom: 0.1rem;
.search__hits__platform {
margin-top: 0.2rem;
}
& > svg {
height: 0.8rem;
width: 0.8rem;
@@ -310,19 +307,6 @@
place-content: center;
}
.search__hits__platform {
font-size: 0.65rem;
color: var(--text-muted-color);
line-height: 1;
border: 1px solid var(--is-hit-platform-border-color);
border-radius: $border-radius;
padding: 0.1rem 0.2rem;
width: fit-content;
margin: 0.4rem 0.35rem 0 0;
display: inline-block;
}
.search__hits--empty {
margin: 0;
padding: 0;
@@ -454,14 +438,6 @@
margin-top: 1rem;
}
.search__form {
border: 1px solid var(--is-search-border-color);
&:focus-within {
box-shadow: 0 0 0 3px var(--is-search-focus-box-shadow);
}
}
#search-powered-by {
position: absolute;
top: -2.25rem;
@@ -477,30 +453,6 @@
&:not(.ais-Hits--empty) {
position: relative;
&:before {
content: "Search Results";
padding-left: 0.75rem;
font-size: $font-size-sm;
font-weight: $font-weight-medium;
display: inline-block;
background-color: var(--body-bg);
position: relative;
padding-right: 0.5rem;
z-index: 2;
padding-bottom: 0.5rem;
}
&:after {
content: "";
height: 1px;
position: absolute;
top: 1rem;
left: 0;
width: 100%;
z-index: 1;
background-color: var(--theme-light-bg);
}
}
}

View File

@@ -1,5 +1,6 @@
<!-- Algolia meta attrs -->
<meta name="docsearch:site" content="docs"/>
<meta name="docsearch:edition" content="community"/>
<meta name="pagename" content="{{ pagename }}"/>
<!-- Preload fonts and scripts -->