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 (
|
import (
|
||||||
"html/template"
|
"html/template"
|
||||||
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -19,6 +20,13 @@ func (bm Bookmark) Type() string {
|
|||||||
return "bookmark"
|
return "bookmark"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (bm Bookmark) DisplayTitle() string {
|
||||||
|
if strings.TrimSpace(bm.Info.Title) == "" {
|
||||||
|
return bm.URL
|
||||||
|
}
|
||||||
|
return bm.Info.Title
|
||||||
|
}
|
||||||
|
|
||||||
type PageInfo struct {
|
type PageInfo struct {
|
||||||
Fetched time.Time
|
Fetched time.Time
|
||||||
Title string
|
Title string
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<ul>
|
<ul>
|
||||||
{{ range .results }}
|
{{ range .results }}
|
||||||
<li>
|
<li>
|
||||||
<a href="{{ .Bookmark.URL }}">{{ .Bookmark.Info.Title }}</a><br>
|
<a href="{{ .Bookmark.URL }}">{{ .Bookmark.DisplayTitle }}</a><br>
|
||||||
{{ .Highlight }}
|
{{ .Highlight }}
|
||||||
</li>
|
</li>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user