From 4f45e8fe1c82268be02ac8eaa72e9ac796eedc3c Mon Sep 17 00:00:00 2001 From: Kaushal Modi Date: Sun, 22 Apr 2018 23:19:06 -0400 Subject: [PATCH] Fix the link type attribute for RSS in examples Fixes https://github.com/gohugoio/hugoDocs/issues/455. --- content/templates/rss.md | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/content/templates/rss.md b/content/templates/rss.md index 9acbeea47..7162597aa 100644 --- a/content/templates/rss.md +++ b/content/templates/rss.md @@ -98,22 +98,30 @@ Hugo will automatically add the following header line to this file on render. Pl In your `header.html` template, you can specify your RSS feed in your `` tag using Hugo's [Output Formats][Output Formats] like this: -``` +```go-html-template {{ range .AlternativeOutputFormats -}} - + {{ printf `` .Rel .MediaType.Type .MediaType.Suffix .Permalink $.Site.Title | safeHTML }} {{ end -}} ``` -If you only want the RSS link, you can query the formats: +If you only want the RSS link, you can query the formats: -``` +```go-html-template {{ with .OutputFormats.Get "rss" -}} - -{{ end -} + {{ printf `` .Rel .MediaType.Type .MediaType.Suffix .Permalink $.Site.Title | safeHTML }} +{{ end -}} ``` - + +Either of the two snippets above will generate the below `link` tag on the site homepage for RSS output: + +```html + +``` + +_We are assuming `BaseURL` to be `https://example.com/` and `$.Site.Title` to be `"Site Title"` in this example._ + [config]: /getting-started/configuration/ [embedded]: #the-embedded-rss-xml [RSS 2.0]: http://cyber.law.harvard.edu/rss/rss.html "RSS 2.0 Specification" [section]: /content-management/sections/ -[Output Formats]: /templates/output-formats/#link-to-output-formats \ No newline at end of file +[Output Formats]: /templates/output-formats/#link-to-output-formats