From e0a857eafebd92d5e94d156997d5d9422a50933f Mon Sep 17 00:00:00 2001 From: René 'Necoro' Neumann Date: Wed, 6 May 2020 22:56:38 +0200 Subject: Improve template --- internal/feed/item.go | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'internal/feed/item.go') diff --git a/internal/feed/item.go b/internal/feed/item.go index b8fb7f7..bbf7668 100644 --- a/internal/feed/item.go +++ b/internal/feed/item.go @@ -17,8 +17,8 @@ type feedImage struct { } type item struct { - *gofeed.Feed *gofeed.Item + Feed *gofeed.Feed feed *Feed Body string updateOnly bool @@ -28,14 +28,22 @@ type item struct { } // Creator returns the name of the creating author. -// MUST NOT have `*item` has the receiver, because the template breaks then. func (item *item) Creator() string { - if item.Item.Author != nil { - return item.Item.Author.Name + if item.Author != nil { + return item.Author.Name } return "" } +func (item *item) FeedLink() string { + if item.Feed.Link != "" { + // the one in the feed itself + return item.Feed.FeedLink + } + // the one in the config + return item.feed.Url +} + func (item *item) addReason(reason string) { if !util.StrContains(item.reasons, reason) { item.reasons = append(item.reasons, reason) -- cgit v1.2.3-70-g09d2