Added Tags to RSS feed as categories

This commit is contained in:
2024-03-05 18:20:34 +01:00
parent a9c61c5a11
commit 4aa4fff5e8
6 changed files with 18 additions and 7 deletions

View File

@ -58,6 +58,9 @@ func FinishArticle(al *data.ArticleList, s *data.CookieStore) http.HandlerFunc {
return
}
r.ParseForm()
article.Tags = append(article.Tags, r.Form["tags"]...)
session, err := s.Get(r, "cookie")
if err != nil {
tmpl, err := template.ParseFiles("web/templates/login.html")
@ -71,7 +74,7 @@ func FinishArticle(al *data.ArticleList, s *data.CookieStore) http.HandlerFunc {
article.AuthorID = session.Values["id"].(int64)
al.Add(article)
al.Save("tmp/articles.gob")
al.Save("tmp/unpublished-articles.gob")
tmpl, err := template.ParseFiles("web/templates/hub.html")
tmpl = template.Must(tmpl, err)
@ -147,6 +150,7 @@ func PublishArticle(c *data.Channel, al *data.ArticleList, s *data.CookieStore)
PubDate: article.Created.Format(time.RFC1123Z),
Description: article.Desc,
Content: &rss.Content{Value: article.Content},
Categories: article.Tags,
})
c.Save("tmp/rss.gob")