|
1 | 1 | {{- $pctx := . -}} |
2 | | -{{- if .IsHome -}}{{ $pctx = .Site }}{{- end -}} |
| 2 | +{{- if .IsHome -}} |
| 3 | + {{ $pctx = .Site }} |
| 4 | +{{- end -}} |
| 5 | + |
3 | 6 | {{- $pages := slice -}} |
4 | 7 | {{- if or $.IsHome $.IsSection -}} |
5 | | -{{- $pages = $pctx.RegularPages -}} |
| 8 | + {{- $pages = $pctx.RegularPages -}} |
6 | 9 | {{- else -}} |
7 | | -{{- $pages = $pctx.Pages -}} |
| 10 | + {{- $pages = $pctx.Pages -}} |
8 | 11 | {{- end -}} |
| 12 | + |
9 | 13 | {{- $limit := .Site.Config.Services.RSS.Limit -}} |
10 | 14 | {{- if ge $limit 1 -}} |
11 | | -{{- $pages = $pages | first $limit -}} |
| 15 | + {{- $pages = $pages | first $limit -}} |
12 | 16 | {{- end -}} |
| 17 | + |
13 | 18 | {{- printf "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\"?>" | safeHTML }} |
14 | 19 | <rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"> |
15 | 20 | <channel> |
16 | 21 | <title>{{ if eq .Title .Site.Title }}{{ .Site.Title }}{{ else }}{{ with .Title }}{{.}} on {{ end }}{{ .Site.Title }}{{ end }}</title> |
17 | 22 | <link>{{ .Permalink }}</link> |
18 | 23 | <description>Recent content {{ if ne .Title .Site.Title }}{{ with .Title }}in {{.}} {{ end }}{{ end }}on {{ .Site.Title }}</description> |
19 | | - <generator>Hugo -- gohugo.io</generator>{{ with .Site.LanguageCode }} |
20 | | - <language>{{.}}</language>{{end}}{{ with .Site.Author.email }} |
21 | | - <managingEditor>{{.}}{{ with $.Site.Author.name }} ({{.}}){{end}}</managingEditor>{{end}}{{ with .Site.Author.email }} |
22 | | - <webMaster>{{.}}{{ with $.Site.Author.name }} ({{.}}){{end}}</webMaster>{{end}}{{ with .Site.Copyright }} |
23 | | - <copyright>{{.}}</copyright>{{end}}{{ if not .Date.IsZero }} |
24 | | - <lastBuildDate>{{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</lastBuildDate>{{ end }} |
| 24 | + <generator>Hugo -- gohugo.io</generator> |
| 25 | + |
| 26 | + {{- with .Site.LanguageCode }} |
| 27 | + <language>{{.}}</language> |
| 28 | + {{- end }} |
| 29 | + |
| 30 | + {{- with .Site.Author.email }} |
| 31 | + <managingEditor>{{.}}{{with $.Site.Author.name}} ({{.}}){{end}}</managingEditor> |
| 32 | + <webMaster>{{.}}{{with $.Site.Author.name}} ({{.}}){{end}}</webMaster> |
| 33 | + {{- end}} |
| 34 | + |
| 35 | + {{- with .Site.Params.Copyright }} |
| 36 | + <copyright>{{.}}</copyright> |
| 37 | + {{- end}} |
| 38 | + |
| 39 | + {{- if not .Date.IsZero }} |
| 40 | + <lastBuildDate>{{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</lastBuildDate> |
| 41 | + {{- end }} |
| 42 | + |
25 | 43 | {{- with .OutputFormats.Get "RSS" -}} |
26 | | - {{ printf "<atom:link href=%q rel=\"self\" type=%q />" .Permalink .MediaType | safeHTML }} |
| 44 | + {{ printf "<atom:link href=%q rel=\"self\" type=%q />" .Permalink .MediaType | safeHTML }} |
27 | 45 | {{- end -}} |
28 | | - {{ range $pages }} |
| 46 | + |
| 47 | + {{- range $pages }} |
29 | 48 | <item> |
30 | 49 | <title>{{ .Title }}</title> |
31 | 50 | <link>{{ .Permalink }}</link> |
32 | 51 | <pubDate>{{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</pubDate> |
33 | | - {{ with .Site.Author.email }}<author>{{.}}{{ with $.Site.Author.name }} ({{.}}){{end}}</author>{{end}} |
| 52 | + |
| 53 | + {{- with .Site.Author.email }} |
| 54 | + <author>{{.}}{{ with $.Site.Author.name }} ({{.}}){{end}}</author> |
| 55 | + {{- end}} |
| 56 | + |
34 | 57 | <guid>{{ .Permalink }}</guid> |
35 | 58 | <description>{{ .Summary | html }}</description> |
36 | 59 | <content>{{ .Content | html }}</content> |
37 | 60 | </item> |
38 | | - {{ end }} |
| 61 | + {{- end }} |
39 | 62 | </channel> |
40 | 63 | </rss> |
0 commit comments