Merge pull request #23083 from kbhawkey/kb-move-search-page

move search.md
pull/23567/head
Kubernetes Prow Robot 2020-08-30 06:44:22 -07:00 committed by GitHub
commit 8622cd09d6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 59 additions and 52 deletions

View File

@ -23,8 +23,7 @@ limitations under the License.
}
var query = $(this).val();
var searchPage = "{{ "docs/search/" | absURL }}?q=" + query;
document.location = searchPage;
document.location = "{{ "search/" | absURL }}?q=" + query;
return false;
});

View File

@ -0,0 +1,56 @@
<!doctype html>
<html lang="{{ .Site.Language.Lang }}" class="{{.Params.class}} no-js">
<head>
{{ partial "head.html" . }}
</head>
<body class="td-{{ .Kind }}{{- if ne .Params.cid "" -}}{{- printf " cid-%s" (lower .Params.cid) -}}{{- end -}}">
<header>
{{ partial "navbar.html" . }}
</header>
{{ block "announcement" . }}
{{ if .IsHome }}
{{ partial "frontpage-announcement.html" . }}
{{ else }}
{{ partial "announcement.html" . }}
{{ end }}
{{ end }}
<div class="td-outer">
<main role="main" class="td-main">
<section class="row td-search-result">
<div class="col-12 col-md-4 offset-md-2">
<form class="td-sidebar__search d-flex align-items-center">
{{ partial "search-input.html" . }}
<button class="btn btn-link td-sidebar__toggle d-md-none p-0 ml-3 fas fa-bars" type="button" data-toggle="collapse" data-target="#td-section-nav" aria-controls="td-docs-nav" aria-expanded="false" aria-label="Toggle section navigation">
</button>
</form>
</div>
<div class="col-12 col-md-8 offset-md-2">
<h2 class="ml-4">{{ .Title }}</h2>
{{ if .Site.Params.gcs_engine_id }}
<script>
(function() {
var cx = '{{ . }}';
var gcse = document.createElement('script');
gcse.type = 'text/javascript';
gcse.async = true;
gcse.src = 'https://cse.google.com/cse.js?cx=' + cx;
var s = document.getElementsByTagName('script')[0];
s.parentNode.insertBefore(gcse, s);
})();
</script>
<gcse:searchresults-only></gcse:searchresults-only>
{{ else if .Site.Params.k8s_search }}
<script src="{{ "js/search.js" | relURL }}"></script>
<gcse:searchresults-only linktarget="_parent">
<div id="bing-results-container">{{ T "layouts_docs_search_fetching" }}</div>
<div id="bing-pagination-container"></div>
</gcse:searchresults-only>
{{ end }}
</div>
</section>
</main>
{{ partial "footer.html" . }}
</div>
{{ partialCached "scripts.html" . }}
</body>
</html>

View File

@ -1,27 +0,0 @@
{{ define "main" }}
<section class="row td-search-result">
<div class="col-12 col-md-8 offset-md-2">
<h2 class="ml-4">{{ .Title }}</h2>
{{ if .Site.Params.gcs_engine_id }}
<script>
(function() {
var cx = '{{ . }}';
var gcse = document.createElement('script');
gcse.type = 'text/javascript';
gcse.async = true;
gcse.src = 'https://cse.google.com/cse.js?cx=' + cx;
var s = document.getElementsByTagName('script')[0];
s.parentNode.insertBefore(gcse, s);
})();
</script>
<gcse:searchresults-only></gcse:searchresults-only>
{{ else if .Site.Params.k8s_search }}
<script src="{{ "js/search.js" | relURL }}"></script>
<gcse:searchresults-only linktarget="_parent">
<div id="bing-results-container">{{ T "layouts_docs_search_fetching" }}</div>
<div id="bing-pagination-container"></div>
</gcse:searchresults-only>
{{ end }}
</div>
</section>
{{ end }}

View File

@ -1,21 +0,0 @@
{{ $p := . }}
{{ $home := site.Home }}
{{ $docs := site.GetPage "section" "docs" }}
{{ $menuSections := (where $docs.Sections ".Params.main_menu" true) }}
{{ range $menuSections }}
{{ if $p.IsDescendant . }}
<h1>{{ if not (strings.Contains .Path "home")}}{{ .Params.bigheader | default .Title }}{{ end }}</h1>
<h5>{{ .Params.abstract }}</h5>
{{ end }}
{{ end }}
<div id="vendorStrip" class="light-text">
<ul>
{{ range $menuSections }}
{{ $yah := $p.IsDescendant . }}
<li><a href="{{ .RelPermalink }}"{{ if $yah }} class="YAH"{{ end }} data-proofer-ignore>{{ .LinkTitle | upper }}</a></li>
{{ end }}
</ul>
<form id="searchBox" action="/docs/search/" role="search">
<input type="text" id="search" name="q" placeholder="{{ T "ui_search_placeholder" }}" aria-label="Search">
</form>
</div>

View File

@ -58,7 +58,7 @@
{{- if not .Site.Params.deprecated }}
"potentialAction": {
"@type": "SearchAction",
"target": {{ printf "%s%s" ("/docs/search/" | absURL) "?q={search_term_string}" }},
"target": {{ printf "%s%s" ("search/" | absURL) "?q={search_term_string}" }},
"query-input": "required name=search_term_string"
}
{{ end }}

View File

@ -17,7 +17,7 @@
for(var i = 1; i <= 10; i++){
if(i > pages) break;
pageAnchors += '<a class="bing-page-anchor" href="/docs/search/?q='+searchTerm+'&page='+i+'">';
pageAnchors += '<a class="bing-page-anchor" href="/search/?q='+searchTerm+'&page='+i+'">';
pageAnchors += (currentPage == i) ? '<b>'+i+'</b>' : i;
pageAnchors += '</a>';
}