description in rss items

This commit is contained in:
Niko Abeler 2022-10-14 21:06:26 +02:00
parent edf74aa330
commit 5fb96ee6fd
1 changed files with 11 additions and 8 deletions

19
rss.go
View File

@ -20,10 +20,11 @@ type RSSChannel struct {
} }
type RSSItem struct { type RSSItem struct {
Guid string `xml:"guid"` Guid string `xml:"guid"`
Title string `xml:"title"` Title string `xml:"title"`
Link string `xml:"link"` Link string `xml:"link"`
PubDate string `xml:"pubDate"` PubDate string `xml:"pubDate"`
Description string `xml:"description"`
} }
func RenderRSSFeed(user User) (string, error) { func RenderRSSFeed(user User) (string, error) {
@ -43,11 +44,13 @@ func RenderRSSFeed(user User) (string, error) {
posts, _ := user.Posts() posts, _ := user.Posts()
for _, post := range posts { for _, post := range posts {
meta := post.Meta() meta := post.Meta()
content, _ := renderPostContent(post)
rss.Channel.Items = append(rss.Channel.Items, RSSItem{ rss.Channel.Items = append(rss.Channel.Items, RSSItem{
Guid: post.FullUrl(), Guid: post.FullUrl(),
Title: post.Title(), Title: post.Title(),
Link: post.FullUrl(), Link: post.FullUrl(),
PubDate: meta.Date.Format(time.RFC1123Z), PubDate: meta.Date.Format(time.RFC1123Z),
Description: content,
}) })
} }