|
1 | | -{{- /* Deprecate site.Author.email in favor of site.Params.author.email */}} |
2 | 1 | {{- $authorEmail := "" }} |
3 | 2 | {{- with site.Params.author }} |
4 | 3 | {{- if reflect.IsMap . }} |
5 | 4 | {{- with .email }} |
6 | 5 | {{- $authorEmail = . }} |
7 | 6 | {{- end }} |
8 | 7 | {{- end }} |
9 | | -{{- else }} |
10 | | - {{- with site.Author.email }} |
11 | | - {{- $authorEmail = . }} |
12 | | - {{- warnf "The author key in site configuration is deprecated. Use params.author.email instead." }} |
13 | | - {{- end }} |
14 | 8 | {{- end }} |
15 | 9 |
|
16 | | -{{- /* Deprecate site.Author.name in favor of site.Params.author.name */}} |
17 | 10 | {{- $authorName := "" }} |
18 | 11 | {{- with site.Params.author }} |
19 | 12 | {{- if reflect.IsMap . }} |
|
23 | 16 | {{- else }} |
24 | 17 | {{- $authorName = . }} |
25 | 18 | {{- end }} |
26 | | -{{- else }} |
27 | | - {{- with site.Author.name }} |
28 | | - {{- $authorName = . }} |
29 | | - {{- warnf "The author key in site configuration is deprecated. Use params.author.name instead." }} |
30 | | - {{- end }} |
31 | 19 | {{- end }} |
32 | 20 |
|
33 | 21 | {{- $pctx := . }} |
34 | | -{{- if .IsHome }}{{ $pctx = site }}{{ end }} |
| 22 | +{{- if .IsHome }}{{ $pctx = .Site }}{{ end }} |
35 | 23 | {{- $pages := slice }} |
36 | 24 | {{- if or $.IsHome $.IsSection }} |
37 | 25 | {{- $pages = $pctx.RegularPages }} |
38 | 26 | {{- else }} |
39 | 27 | {{- $pages = $pctx.Pages }} |
40 | 28 | {{- end }} |
41 | | -{{- $limit := site.Config.Services.RSS.Limit }} |
| 29 | +{{- $limit := .Site.Config.Services.RSS.Limit }} |
42 | 30 | {{- if ge $limit 1 }} |
43 | 31 | {{- $pages = $pages | first $limit }} |
44 | 32 | {{- end }} |
45 | 33 | {{- printf "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\"?>" | safeHTML }} |
46 | | -<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/"> |
| 34 | +<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"> |
47 | 35 | <channel> |
48 | | - <title>{{ if eq .Title site.Title }}{{ site.Title }}{{ else }}{{ with .Title }}{{ . }} on {{ end }}{{ site.Title }}{{ end }}</title> |
| 36 | + <title>{{ if eq .Title .Site.Title }}{{ .Site.Title }}{{ else }}{{ with .Title }}{{ . }} on {{ end }}{{ .Site.Title }}{{ end }}</title> |
49 | 37 | <link>{{ .Permalink }}</link> |
50 | | - <description>Recent content {{ if ne .Title site.Title }}{{ with .Title }}in {{ . }} {{ end }}{{ end }}on {{ site.Title }}</description> |
51 | | - {{- with site.Params.images }} |
52 | | - <image> |
53 | | - <title>{{ site.Title }}</title> |
54 | | - <url>{{ index . 0 | absURL }}</url> |
55 | | - <link>{{ index . 0 | absURL }}</link> |
56 | | - </image> |
57 | | - {{- end }} |
58 | | - <generator>Hugo -- {{ hugo.Version }}</generator> |
| 38 | + <description>Recent content {{ if ne .Title .Site.Title }}{{ with .Title }}in {{ . }} {{ end }}{{ end }}on {{ .Site.Title }}</description> |
| 39 | + <generator>Hugo</generator> |
59 | 40 | <language>{{ site.Language.LanguageCode }}</language>{{ with $authorEmail }} |
60 | 41 | <managingEditor>{{.}}{{ with $authorName }} ({{ . }}){{ end }}</managingEditor>{{ end }}{{ with $authorEmail }} |
61 | | - <webMaster>{{ . }}{{ with $authorName }} ({{ . }}){{ end }}</webMaster>{{ end }}{{ with site.Copyright }} |
62 | | - <copyright>{{ . | markdownify | plainify | strings.TrimPrefix "© " }}</copyright>{{ end }}{{ if not .Date.IsZero }} |
| 42 | + <webMaster>{{ . }}{{ with $authorName }} ({{ . }}){{ end }}</webMaster>{{ end }}{{ with .Site.Copyright }} |
| 43 | + <copyright>{{ . }}</copyright>{{ end }}{{ if not .Date.IsZero }} |
63 | 44 | <lastBuildDate>{{ (index $pages.ByLastmod.Reverse 0).Lastmod.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</lastBuildDate>{{ end }} |
64 | 45 | {{- with .OutputFormats.Get "RSS" }} |
65 | 46 | {{ printf "<atom:link href=%q rel=\"self\" type=%q />" .Permalink .MediaType | safeHTML }} |
66 | 47 | {{- end }} |
67 | 48 | {{- range $pages }} |
68 | | - {{- if and (ne .Layout `search`) (ne .Layout `archives`) }} |
69 | 49 | <item> |
70 | 50 | <title>{{ .Title }}</title> |
71 | 51 | <link>{{ .Permalink }}</link> |
72 | 52 | <pubDate>{{ .PublishDate.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</pubDate> |
73 | 53 | {{- with $authorEmail }}<author>{{ . }}{{ with $authorName }} ({{ . }}){{ end }}</author>{{ end }} |
74 | | - {{ if .Params.GUID }} <guid isPermaLink="false">{{ .Params.guid }}</guid> {{ else }} <guid isPermaLink="false">{{ .Permalink }}</guid> {{ end }} |
75 | | - <description>{{ with .Description | html }}{{ . }}{{ else }}{{ .Summary | html }}{{ end -}}</description> |
76 | | - {{- if and site.Params.ShowFullTextinRSS .Content }} |
77 | | - <content:encoded>{{ (printf "<![CDATA[%s]]>" .Content) | safeHTML }}</content:encoded> |
78 | | - {{- end }} |
| 54 | + <guid>{{ .Permalink }}</guid> |
| 55 | + <description>{{ .Content | transform.XMLEscape | safeHTML }}</description> |
79 | 56 | </item> |
80 | 57 | {{- end }} |
81 | | - {{- end }} |
82 | 58 | </channel> |
83 | 59 | </rss> |
| 60 | + |
0 commit comments