diff --git a/lib/admin.go b/lib/admin.go index 67fa00b..20a5203 100644 --- a/lib/admin.go +++ b/lib/admin.go @@ -68,7 +68,11 @@ func editHandler(h handler) { var data bookData data.Book = book data.S = GetStatus(h) - data.S.Title = book.Title + " by " + book.Author[0] + " -- Edit -- " + data.S.Title + author := "" + if len(book.Author) > 0 { + author = " by " + book.Author[0] + } + data.S.Title = book.Title + author + " -- Edit -- " + data.S.Title h.template.load(h, "edit", data) } diff --git a/lib/reader.go b/lib/reader.go index fffc59a..4a4c0e7 100644 --- a/lib/reader.go +++ b/lib/reader.go @@ -157,7 +157,13 @@ func readHandler(h handler) { var data readData data.S = GetStatus(h) - data.S.Title = book.Title + " by " + book.Author[0] + " -- Read -- " + data.S.Title + + author := "" + if len(book.Author) > 0 { + author = " by " + book.Author[0] + } + data.S.Title = book.Title + author + " -- Read -- " + data.S.Title + data.Book = book if !book.Active { data.Back = "/new/" diff --git a/lib/trantor.go b/lib/trantor.go index f1db9bb..c315c91 100644 --- a/lib/trantor.go +++ b/lib/trantor.go @@ -66,7 +66,13 @@ func bookHandler(h handler) { return } data.Book = book - data.S.Title = book.Title + " by " + book.Author[0] + " -- " + data.S.Title + + author := "" + if len(book.Author) > 0 { + author = " by " + book.Author[0] + } + data.S.Title = book.Title + author + " -- " + data.S.Title + data.Description = strings.Split(data.Book.Description, "\n") data.FlaggedBadQuality = false for _, reporter := range book.BadQualityReporters {