docs/pkg/help/templates/search.html
Snider 6b0443c6f7 feat: import go-help library as pkg/help
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>
2026-03-06 16:30:16 +00:00

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 &ldquo;{{.Query}}&rdquo;{{else}}No results for &ldquo;{{.Query}}&rdquo;{{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}}