Fix the AlternativeOutputFormats/OutputFormats examples

Ref:
https://github.com/gohugoio/hugo/pull/4925#issuecomment-403940096,
https://github.com/gohugoio/hugo/issues/5032

Also fix https://gohugo.io/templates/rss/ returning 404.
This commit is contained in:
Kaushal Modi
2018-08-06 10:47:22 -04:00
parent f64a224692
commit ce14da4350
+2 -3
View File
@@ -14,7 +14,6 @@ menu:
weight: 150
sections_weight: 150
draft: false
aliases: [/templates/rss/]
toc: true
---
@@ -100,7 +99,7 @@ In your `header.html` template, you can specify your RSS feed in your `<head></h
```go-html-template
{{ range .AlternativeOutputFormats -}}
{{ printf `<link rel="%s" type="%s+%s" href="%s" title="%s" />` .Rel .MediaType.Type .MediaType.Suffix .Permalink $.Site.Title | safeHTML }}
{{ printf `<link rel="%s" type="%s" href="%s" title="%s" />` .Rel .MediaType.Type .Permalink $.Site.Title | safeHTML }}
{{ end -}}
```
@@ -108,7 +107,7 @@ If you only want the RSS link, you can query the formats:
```go-html-template
{{ with .OutputFormats.Get "rss" -}}
{{ printf `<link rel="%s" type="%s+%s" href="%s" title="%s" />` .Rel .MediaType.Type .MediaType.Suffix .Permalink $.Site.Title | safeHTML }}
{{ printf `<link rel="%s" type="%s" href="%s" title="%s" />` .Rel .MediaType.Type .Permalink $.Site.Title | safeHTML }}
{{ end -}}
```