In search results show URL if title is empty
This commit is contained in:
parent
dd681a1099
commit
0dccd9f0f0
@ -2,6 +2,7 @@ package entity
|
||||
|
||||
import (
|
||||
"html/template"
|
||||
"strings"
|
||||
"time"
|
||||
)
|
||||
|
||||
@ -19,6 +20,13 @@ func (bm Bookmark) Type() string {
|
||||
return "bookmark"
|
||||
}
|
||||
|
||||
func (bm Bookmark) DisplayTitle() string {
|
||||
if strings.TrimSpace(bm.Info.Title) == "" {
|
||||
return bm.URL
|
||||
}
|
||||
return bm.Info.Title
|
||||
}
|
||||
|
||||
type PageInfo struct {
|
||||
Fetched time.Time
|
||||
Title string
|
||||
|
@ -1,7 +1,7 @@
|
||||
<ul>
|
||||
{{ range .results }}
|
||||
<li>
|
||||
<a href="{{ .Bookmark.URL }}">{{ .Bookmark.Info.Title }}</a><br>
|
||||
<a href="{{ .Bookmark.URL }}">{{ .Bookmark.DisplayTitle }}</a><br>
|
||||
{{ .Highlight }}
|
||||
</li>
|
||||
{{ end }}
|
||||
|
Loading…
x
Reference in New Issue
Block a user