| <!-- |
| Copyright 2019 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 "pre_content"}} |
| <link href="/static/css/search.css?version={{.AppVersionLabel}}" rel="stylesheet"> |
| {{end}} |
| |
| {{define "main_content"}} |
| <div class="Container"> |
| <div class="SearchResults"> |
| <h1 class="SearchResults-header">Results for “{{.Query}}”</h1> |
| <div class="SearchResults-help"><a href="/search-help">Search help</a></div> |
| <div class="SearchResults-resultCount"> |
| {{template "pagination_summary" .Pagination}} {{pluralize .Pagination.TotalCount "result"}} |
| {{template "pagination_nav" .Pagination}} |
| </div> |
| {{if eq (len .Results) 0}} |
| <div> |
| <img class="SearchResults-emptyContentGopher" src="/static/img/gopher-airplane.svg" alt="The Go Gopher"> |
| <h3 class="SearchResults-emptyContentMessage">No results found.</h3> |
| <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> |
| </div> |
| {{else}} |
| <div>{{/* Containing element is needed to use *-of-type selectors */}} |
| {{$query := .Query}} |
| {{range $i, $v := .Results}} |
| <div class="SearchSnippet"> |
| <h2 class="SearchSnippet-header"> |
| <a href="/{{$v.PackagePath}}" data-gtmc="search result" data-gtmv="{{$i}}" |
| data-test-id="snippet-title"> |
| {{$v.PackagePath}} |
| </a> |
| </h2> |
| <p class="SearchSnippet-synopsis" data-test-id="snippet-synopsis">{{$v.Synopsis}}</p> |
| <div class="SearchSnippet-infoLabel"> |
| <b class="InfoLabel-title">Version:</b> |
| <span data-test-id="snippet-version"> {{$v.DisplayVersion}}</span> |
| <span class="InfoLabel-divider">|</span> |
| <b class="InfoLabel-title">Published:</b> |
| <span data-test-id="snippet-published"> {{$v.CommitTime}}</span> |
| <span class="InfoLabel-divider">|</span> |
| <b class="InfoLabel-title">Imported by:</b> |
| <span data-test-id="snippet-importedby"> {{$v.NumImportedBy}}</span> |
| <span class="InfoLabel-divider">|</span> |
| <b class="InfoLabel-title">{{pluralize (len $v.Licenses) "License"}}:</b> |
| <span data-test-id="snippet-license"> |
| {{if $v.Licenses}} |
| {{commaseparate $v.Licenses}} |
| {{else}} |
| <span>N/A</span> |
| {{end}} |
| </span> |
| </div> |
| </div> |
| {{end}} |
| {{end}} |
| </div> |
| <div class="SearchResults-footer"> |
| {{template "pagination_nav" .Pagination}} |
| </div> |
| </div> |
| </div> |
| {{end}} |