+7
-5
internal/rss/feed.go
+7
-5
internal/rss/feed.go
···
13
13
GUID string
14
14
Title string
15
15
Description string
16
+
Comments string
16
17
Link string
17
18
Published time.Time
18
19
}
···
41
42
}
42
43
43
44
// Limit the number of items to return
44
-
maxItems := len(feed.Items)
45
-
items := make([]*FeedItem, 0, maxItems)
46
-
for i := 0; i < maxItems; i++ {
47
-
item := feed.Items[i]
48
-
45
+
items := make([]*FeedItem, 0, len(feed.Items))
46
+
for _, item := range feed.Items {
49
47
published := time.Now()
50
48
if item.PublishedParsed != nil {
51
49
published = *item.PublishedParsed
···
59
57
guid = item.Link
60
58
}
61
59
60
+
// Check for comments link in custom fields
61
+
comments, _ := item.Custom["comments"]
62
+
62
63
items = append(items, &FeedItem{
63
64
GUID: guid,
64
65
Title: item.Title,
65
66
Description: item.Description,
67
+
Comments: comments,
66
68
Link: item.Link,
67
69
Published: published,
68
70
})
+5
-1
main.go
+5
-1
main.go
···
242
242
}
243
243
244
244
func formatPost(item *rss.FeedItem) string {
245
-
// Start with title
246
245
text := item.Title
247
246
248
247
// Add link if available
249
248
if item.Link != "" {
250
249
text += "\n\n" + item.Link
250
+
}
251
+
252
+
// Add comments if available
253
+
if item.Comments != "" {
254
+
text += "\n\nComments: " + item.Comments
251
255
}
252
256
253
257
// Truncate if too long