go-help/templates/search.html
Snider 944cad006b feat(help): Phase 2 — HTTP server, rendering, static site generator, CLI ingestion
Add complete HTTP server and rendering layer for the help catalog:

- render.go: Markdown-to-HTML via goldmark (GFM, typographer, raw HTML)
- server.go: HTTP server with 6 routes (HTML index/topic/search + JSON API)
- templates.go: Embedded HTML templates with dark theme (bg #0d1117)
- templates/: base, index, topic, search, 404 page templates
- generate.go: Static site generator with client-side JS search
- ingest.go: CLI help text parser (Usage/Flags/Examples/Commands sections)

320 tests passing, 95.5% coverage, race-clean, vet-clean.

Co-Authored-By: Virgil <virgil@lethean.io>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-20 08:50:10 +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}}