From f0a9a17fc09d44c6b1dcba734790a909b5072704 Mon Sep 17 00:00:00 2001 From: Francesco Minnocci Date: Sat, 27 Aug 2022 22:12:47 +0200 Subject: [PATCH] feed: Fix articles' links' URLs --- handler/handler.go | 4 ++-- rss/feed.go | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/handler/handler.go b/handler/handler.go index 54f5da5..677cfc7 100644 --- a/handler/handler.go +++ b/handler/handler.go @@ -198,7 +198,7 @@ func (h *DefaultHandler) HandleNewsFeedPage(w io.Writer) error { 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) } @@ -209,7 +209,7 @@ func (h *DefaultHandler) HandleGuideFeedPage(w io.Writer) error { 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) } diff --git a/rss/feed.go b/rss/feed.go index 0570ced..8b7e853 100644 --- a/rss/feed.go +++ b/rss/feed.go @@ -6,7 +6,7 @@ import ( "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 feed := &feeds.Feed{ @@ -23,7 +23,7 @@ func GenerateRssFeed(entries []*articles.Article, title string, link string, des &feeds.Item{ Id: entry.Id, Title: entry.Title, - Link: &feeds.Link{Href: config.BaseUrl + "/guide" + entry.Id}, + Link: &feeds.Link{Href: config.BaseUrl + "/" + sectionName + "/" + entry.Id}, Description: entry.Description, Created: entry.PublishDate, })