All source, tests, and templates from forge.lthn.ai/core/go-help. 94% test coverage preserved. All tests pass. Co-Authored-By: Virgil <virgil@lethean.io>
22 lines
871 B
HTML
22 lines
871 B
HTML
{{define "title"}}Search: {{.Query}} - Help{{end}}
|
|
{{define "search_value"}}{{.Query}}{{end}}
|
|
{{define "content"}}
|
|
<h1>Search Results</h1>
|
|
<p style="color: var(--fg-muted);">
|
|
{{if .Results}}Found {{len .Results}} {{pluralise (len .Results) "result" "results"}} for “{{.Query}}”{{else}}No results for “{{.Query}}”{{end}}
|
|
</p>
|
|
|
|
{{if .Results}}
|
|
{{range .Results}}
|
|
<div class="card">
|
|
<h3><a href="/topics/{{.Topic.ID}}">{{.Topic.Title}}</a> <span class="badge">{{printf "%.1f" .Score}}</span></h3>
|
|
{{if .Snippet}}<p>{{.Snippet}}</p>{{end}}
|
|
{{if .Topic.Tags}}<div>{{range .Topic.Tags}}<span class="tag">{{.}}</span>{{end}}</div>{{end}}
|
|
</div>
|
|
{{end}}
|
|
{{else}}
|
|
<div style="margin-top: 2rem; text-align: center; color: var(--fg-muted);">
|
|
<p>Try a different search term or browse <a href="/">all topics</a>.</p>
|
|
</div>
|
|
{{end}}
|
|
{{end}}
|