diff --git a/entity/bookmark.go b/entity/bookmark.go index ad05adf..cd15606 100644 --- a/entity/bookmark.go +++ b/entity/bookmark.go @@ -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 diff --git a/web/templates/search_results.html b/web/templates/search_results.html index f52b78f..b68b534 100644 --- a/web/templates/search_results.html +++ b/web/templates/search_results.html @@ -1,7 +1,7 @@