| <!-- |
| Copyright 2021 The Go Authors. All rights reserved. |
| Use of this source code is governed by a BSD-style |
| license that can be found in the LICENSE file. |
| --> |
| |
| {{define "title"}} |
| <title>{{.Query}} - Search Results · pkg.go.dev</title> |
| {{end}} |
| |
| {{define "pre-content"}} |
| <link href="/static/frontend/search/search.css?version={{.AppVersionLabel}}" rel="stylesheet"> |
| {{end}} |
| |
| {{define "post-content"}} |
| <script> |
| loadScript("/static/frontend/search/search.js") |
| </script> |
| {{end}} |
| |
| {{define "main"}} |
| <main class="go-Container"> |
| <div class="go-Content"> |
| <h1 class="SearchResults-header">Results for “{{.Query}}”</h1> |
| <div class="SearchResults-resultCount go-textSubtle"> |
| {{with .Pagination}} |
| {{ $p := . }} |
| <div class="Pagination-nav"> |
| Displaying {{.ResultCount}} of {{if .Approximate}}about {{end}}{{.TotalCount}} {{pluralize .TotalCount "result"}}. |
| Fetch |
| {{range .Limits}} |
| {{if eq . $p.Limit}} |
| <b class="Pagination-number">{{.}}</b> |
| {{else}} |
| <a class="Pagination-number" href="{{$p.LimitURL .}}">{{.}}</a> |
| {{end}} |
| {{end}} |
| results. |
| </div> |
| {{end}} |
| <div class="SearchResults-help"><a href="/search-help">Search help</a></div> |
| </div> |
| {{if eq (len .Results) 0}} |
| {{template "gopher-airplane" "No results found."}} |
| {{if eq .SearchMode "identifiers"}} |
| <p class="SearchResults-emptyContentMessage"> |
| Try searching for a package by visiting <a href="https://pkg.go.dev/search?q={{.Query}}">pkg.go.dev/search?q={{.Query}}</a>. |
| </p> |
| {{else}} |
| <p class="SearchResults-emptyContentMessage"> |
| If you think “{{.Query}}” is a valid package or module, you could try downloading it by visiting <a href="https://pkg.go.dev/{{.Query}}">pkg.go.dev/{{.Query}}</a>. |
| </p> |
| {{end}} |
| {{else if eq .SearchMode "identifiers"}} |
| <div>{{/* Containing element is needed to use *-of-type selectors */}} |
| {{template "symbol_search" .}} |
| </div> |
| {{else}} |
| <div>{{/* Containing element is needed to use *-of-type selectors */}} |
| {{template "grouped_search" .}} |
| </div> |
| {{end}} |
| </div> |
| </main> |
| {{end}} |
| |
| |
| {{define "grouped_search"}} |
| {{$query := .Query}} |
| {{range $i, $v := .Results}} |
| <div class="SearchSnippet"> |
| <div class="SearchSnippet-headerContainer"> |
| <h2 class="SearchSnippet-header"> |
| <a href="/{{$v.PackagePath}}" data-gtmc="search result" data-gtmv="{{$i}}" |
| data-test-id="snippet-title"> |
| {{$v.Name}} |
| </a> |
| </h2> |
| <span class="SearchSnippet-header-path">{{$v.PackagePath}}</span> |
| </div> |
| <p class="SearchSnippet-synopsis" data-test-id="snippet-synopsis"> |
| {{$v.Synopsis}} |
| </p> |
| {{template "search_metadata" $v}} |
| {{with .SameModule}} |
| <div class="SearchSnippet-sub go-textSubtle"> |
| <span>{{.Heading}}</span> |
| {{range $i, $v := .Links}} |
| <a class="go-Chip go-Chip--highlighted js-sameModChip" |
| href="/{{$v.Href}}" |
| {{if gt $i 4 }}data-hidden="true"{{end}} |
| data-gtmc="search result same module" |
| data-gtmv="{{$i}}"> |
| {{$v.Body}} |
| </a> |
| {{end}} |
| {{$more := subtract (len .Links) 5}} |
| {{if gt (len .Links) 5}} |
| <button class="go-Chip go-Chip--highlighted js-showMoreChip" |
| data-gtmc="search result same module" data-gtmv="{{$i}}"> |
| +{{$more}} more |
| </button> |
| {{end}} |
| </div> |
| {{end}} |
| {{with .OtherMajor}} |
| <div class="SearchSnippet-sub go-textSubtle"> |
| <span>{{.Heading}}</span> |
| {{range $i, $v := .Links}} |
| <a class="go-Chip go-Chip--highlighted" href="/{{$v.Href}}" |
| data-gtmc="search result lower major" data-gtmv="{{$i}}">{{$v.Body}}</a> |
| {{end}} |
| </div> |
| {{end}} |
| </div> <!-- SearchSnippet --> |
| {{end}} |
| {{end}} |
| |
| {{define "search_metadata"}} |
| <div class="SearchSnippet-infoLabel"> |
| <a href="/{{$.PackagePath}}?tab=importedby" aria-label="Go to Imported By"> |
| <span class="go-textSubtle">Imported by: </span><strong>{{.NumImportedBy}}</strong> |
| </a> |
| <span class="go-textSubtle"> |
| Published: {{.DisplayVersion}} • <span data-test-id="snippet-published">{{.CommitTime}}</span> |
| </span> |
| <span data-test-id="snippet-license"> |
| {{if .Licenses}} |
| <a href="/{{$.PackagePath}}?tab=licenses" aria-label="Go to Licenses"> |
| <span class="go-textSubtle">License: </span> |
| {{commaseparate .Licenses}} |
| </a> |
| {{else}} |
| <span class="go-textSubtle">License: </span> |
| <span class="go-textSubtle">N/A</span> |
| {{end}} |
| </span> |
| </div> |
| {{end}} |