forked from jason/cpolis
Instead of having entire articles in the RSS feed, items now contain just a link
This commit is contained in:
@@ -39,7 +39,7 @@ func GetChannel(db *DB, title, link, description string) (*rss.Channel, error) {
|
||||
|
||||
channel.Items = append(channel.Items, &rss.Item{
|
||||
Title: article.Title,
|
||||
Author: user.FirstName + user.LastName,
|
||||
Author: fmt.Sprint(user.FirstName, " ", user.LastName),
|
||||
PubDate: article.Created.Format(time.RFC1123Z),
|
||||
Description: article.Description,
|
||||
Content: &rss.Content{Value: article.Content},
|
||||
@@ -89,14 +89,22 @@ func GenerateRSS(c *Config, db *DB) (*string, error) {
|
||||
return nil, fmt.Errorf("error converting description to plain text for RSS feed: %v", err)
|
||||
}
|
||||
|
||||
channel.Items = append(channel.Items, &rss.Item{
|
||||
Author: fmt.Sprint(user.FirstName, user.LastName),
|
||||
item := &rss.Item{
|
||||
Author: fmt.Sprint(user.FirstName, " ", user.LastName),
|
||||
Categories: tagNames,
|
||||
Description: articleDescription,
|
||||
Link: fmt.Sprintf("http://%s/article/serve/%d", c.Domain, article.ID),
|
||||
PubDate: article.Created.Format(time.RFC1123Z),
|
||||
Title: articleTitle,
|
||||
})
|
||||
}
|
||||
fmt.Println(article.Link, ": ", len(article.Link))
|
||||
|
||||
if article.Link == "" {
|
||||
item.Link = fmt.Sprint("http://", c.Domain, "/article/serve/", article.ID, ".html")
|
||||
} else {
|
||||
item.Link = article.Link
|
||||
}
|
||||
|
||||
channel.Items = append(channel.Items, item)
|
||||
}
|
||||
|
||||
feed := rss.NewFeed()
|
||||
|
||||
Reference in New Issue
Block a user