Improve search result page
This commit is contained in:
+18
-4
@@ -4,15 +4,29 @@
|
||||
|
||||
{{define "content"}}
|
||||
{{if .Query}}
|
||||
{{if .Results}}
|
||||
<p class="muted">{{len .Results}} match{{if ne (len .Results) 1}}es{{end}} for “{{.Query}}”</p>
|
||||
<hr/>
|
||||
{{range .Results}}
|
||||
{{if or .Pages .Files}}
|
||||
{{if .Pages}}
|
||||
<h2 class="search-section">Matching Pages <span class="muted">{{.PageTotal}}</span></h2>
|
||||
{{range .Pages}}
|
||||
<article class="search-card">
|
||||
<a href="{{.URL}}">{{.Name}}</a>
|
||||
<div class="muted">/{{.Path}}</div>
|
||||
</article>
|
||||
{{end}}
|
||||
{{end}}
|
||||
{{if .Files}}
|
||||
<h2 class="search-section">Matching Files <span class="muted">{{.FileTotal}}</span></h2>
|
||||
{{range .Files}}
|
||||
<article class="search-card">
|
||||
<div class="row">
|
||||
{{fileIcon .Name}}
|
||||
<a href="{{.URL}}">{{.Name}}</a>
|
||||
<button class="btn btn-small" data-companion-file-reveal="{{.Path}}" hidden title="Open location in file manager">open</button>
|
||||
</div>
|
||||
<div class="muted">/{{.Path}} · {{.Meta}}</div>
|
||||
</article>
|
||||
{{end}}
|
||||
{{end}}
|
||||
{{else}}
|
||||
<p class="empty">No matches for “{{.Query}}”.</p>
|
||||
{{end}}
|
||||
|
||||
Reference in New Issue
Block a user