feed: Fix articles' links' URLs

feat/db
Francesco Minnocci 2 years ago
parent 1ddc71f64b
commit f0a9a17fc0
Signed by: BachoSeven
GPG Key ID: 2BE4AB7FDAD828A4

@ -198,7 +198,7 @@ func (h *DefaultHandler) HandleNewsFeedPage(w io.Writer) error {
return err return err
} }
newsFeed := rss.GenerateRssFeed(registry, "Feed Notizie PHC", "https://phc.dm.unipi.it/news", "Le ultime nuove sul PHC.") newsFeed := rss.GenerateRssFeed(registry, "news", "Feed Notizie PHC", "https://phc.dm.unipi.it/news", "Le ultime nuove sul PHC.")
return newsFeed.WriteRss(w) return newsFeed.WriteRss(w)
} }
@ -209,7 +209,7 @@ func (h *DefaultHandler) HandleGuideFeedPage(w io.Writer) error {
return err return err
} }
guideFeed := rss.GenerateRssFeed(registry, "Feed Guide PHC", "https://phc.dm.unipi.it/guide", "Le più recenti guide a carattere informatico a cura dei macchinisti del PHC.") guideFeed := rss.GenerateRssFeed(registry, "guide", "Feed Guide PHC", "https://phc.dm.unipi.it/guide", "Le più recenti guide a carattere informatico a cura dei macchinisti del PHC.")
return guideFeed.WriteRss(w) return guideFeed.WriteRss(w)
} }

@ -6,7 +6,7 @@ import (
"github.com/gorilla/feeds" "github.com/gorilla/feeds"
) )
func GenerateRssFeed(entries []*articles.Article, title string, link string, description string) *feeds.Feed { func GenerateRssFeed(entries []*articles.Article, sectionName string, title string, link string, description string) *feeds.Feed {
// Initialize RSS Feed // Initialize RSS Feed
feed := &feeds.Feed{ feed := &feeds.Feed{
@ -23,7 +23,7 @@ func GenerateRssFeed(entries []*articles.Article, title string, link string, des
&feeds.Item{ &feeds.Item{
Id: entry.Id, Id: entry.Id,
Title: entry.Title, Title: entry.Title,
Link: &feeds.Link{Href: config.BaseUrl + "/guide" + entry.Id}, Link: &feeds.Link{Href: config.BaseUrl + "/" + sectionName + "/" + entry.Id},
Description: entry.Description, Description: entry.Description,
Created: entry.PublishDate, Created: entry.PublishDate,
}) })

Loading…
Cancel
Save