add images to rss feeds

This commit is contained in:
Ted Unangst 2020-02-02 18:44:12 -05:00
parent 4c8e162bf4
commit 6c55840690
1 changed files with 4 additions and 1 deletions

5
web.go
View File

@ -215,7 +215,10 @@ func showrss(w http.ResponseWriter, r *http.Request) {
} }
for _, d := range honk.Donks { for _, d := range honk.Donks {
desc += string(templates.Sprintf(`<p><a href="%s">Attachment: %s</a>`, desc += string(templates.Sprintf(`<p><a href="%s">Attachment: %s</a>`,
d.URL, d.Name)) d.URL, d.Desc))
if strings.HasPrefix(d.Media, "image") {
desc += string(templates.Sprintf(`<img src="%s">`, d.URL))
}
} }
feed.Items = append(feed.Items, &rss.Item{ feed.Items = append(feed.Items, &rss.Item{