|
16 | 16 | {{- /* Deprecate site.Author.name in favor of site.Params.author.name */}} |
17 | 17 | {{- $authorName := partialCached "authorname.hugo" . }} |
18 | 18 |
|
19 | | -{{- $pages := .Page.Pages }} |
| 19 | +{{- $pages := .Pages }} |
20 | 20 | {{- $limit := .Site.Config.Services.RSS.Limit }} |
21 | | -{{- if ge $limit 0 }} |
| 21 | +{{- if ge $limit 1 }} |
22 | 22 | {{- $pages = $pages | first $limit }} |
23 | 23 | {{- end }} |
| 24 | + |
24 | 25 | {{- $page := . }} |
25 | 26 | {{- printf "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\"?>" | safeHTML }} |
26 | 27 | <rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"> |
|
33 | 34 | <managingEditor>{{ . }}{{ with $authorName }} ({{ . }}){{ end }}</managingEditor>{{ end }}{{ with $authorEmail }} |
34 | 35 | <webMaster>{{ . }}{{ with $authorName }} ({{ . }}){{ end }}</webMaster>{{ end }}{{ with .Site.Copyright }} |
35 | 36 | <copyright>{{ . }}</copyright>{{ end }}{{ if not .Date.IsZero }} |
36 | | - <lastBuildDate>{{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</lastBuildDate>{{ end }} |
| 37 | + <lastBuildDate>{{ (index $pages.ByLastmod.Reverse 0).Lastmod.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</lastBuildDate>{{ end }} |
37 | 38 | {{- with .OutputFormats.Get "rss" }} |
38 | 39 | {{ printf "<atom:link href=%q rel=\"self\" type=%q />" ( partial "relLangPrettyUglyURL.hugo" (dict "to" . "abs" true)) .MediaType | safeHTML }} |
39 | 40 | {{- end -}} |
|
43 | 44 | <item> |
44 | 45 | <title>{{ .Title }}</title> |
45 | 46 | <link>{{ partial "relLangPrettyUglyURL.hugo" (dict "to" . "abs" true) }}</link> |
46 | | - <pubDate>{{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</pubDate> |
| 47 | + <pubDate>{{ .PublishDate.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</pubDate> |
47 | 48 | {{- with $authorEmail }}<author>{{ . }}{{ with $authorName }} ({{ . }}){{ end }}</author>{{ end }} |
48 | 49 | <guid>{{ partial "relLangPrettyUglyURL.hugo" (dict "to" . "abs" true) }}</guid> |
49 | | - <description>{{ .Summary | html }}</description> |
| 50 | + <description>{{ .Summary | transform.XMLEscape | safeHTML }}</description> |
50 | 51 | </item> |
51 | 52 | {{- end }} |
52 | 53 | {{- end }} |
|
0 commit comments