summaryrefslogtreecommitdiffstats
path: root/hugolib
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2023-06-14 12:04:32 +0200
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2023-06-14 12:18:11 +0200
commit90b2674ddce69a07007b1ba60eb4808bbb38e8a4 (patch)
tree13a4ea606db867b1d5e3293f36f3100f79c97387 /hugolib
parentbb9377b5e552448ca392a7c5b2e20bdb5ee07aa1 (diff)
Re-add site.RSSLink (and deprecate it)
Fixes #11110
Diffstat (limited to 'hugolib')
-rw-r--r--hugolib/site_new.go11
-rw-r--r--hugolib/site_output_test.go3
2 files changed, 7 insertions, 7 deletions
diff --git a/hugolib/site_new.go b/hugolib/site_new.go
index 4b3a28bdd..911414121 100644
--- a/hugolib/site_new.go
+++ b/hugolib/site_new.go
@@ -29,6 +29,7 @@ import (
"github.com/gohugoio/hugo/config"
"github.com/gohugoio/hugo/config/allconfig"
"github.com/gohugoio/hugo/deps"
+ "github.com/gohugoio/hugo/helpers"
"github.com/gohugoio/hugo/identity"
"github.com/gohugoio/hugo/langs"
"github.com/gohugoio/hugo/langs/i18n"
@@ -345,12 +346,10 @@ func (s *Site) Copyright() string {
return s.conf.Copyright
}
-func (s *Site) RSSLink() string {
- rssOutputFormat, found := s.conf.C.KindOutputFormats[page.KindHome].GetByName("rss")
- if !found {
- return ""
- }
- return s.permalink(rssOutputFormat.BaseFilename())
+func (s *Site) RSSLink() template.URL {
+ helpers.Deprecated("Site.RSSLink", "Use the Output Format's Permalink method instead, e.g. .OutputFormats.Get \"RSS\".Permalink", false)
+ rssOutputFormat := s.home.OutputFormats().Get("rss")
+ return template.URL(rssOutputFormat.Permalink())
}
func (s *Site) Config() page.SiteConfig {
diff --git a/hugolib/site_output_test.go b/hugolib/site_output_test.go
index c5cee7641..b598e23d6 100644
--- a/hugolib/site_output_test.go
+++ b/hugolib/site_output_test.go
@@ -15,6 +15,7 @@ package hugolib
import (
"fmt"
+ "html/template"
"strings"
"testing"
@@ -248,7 +249,7 @@ baseName = "feed"
s := h.Sites[0]
// Issue #3450
- c.Assert(s.RSSLink(), qt.Equals, "http://example.com/blog/feed.xml")
+ c.Assert(s.RSSLink(), qt.Equals, template.URL("http://example.com/blog/feed.xml"))
}
// Issue #3614