diff --git a/layouts/_default/rss.xml b/layouts/_default/rss.xml index 4319aa1ae2..8ee0401515 100644 --- a/layouts/_default/rss.xml +++ b/layouts/_default/rss.xml @@ -16,11 +16,12 @@ {{- /* Deprecate site.Author.name in favor of site.Params.author.name */}} {{- $authorName := partialCached "authorname.hugo" . }} -{{- $pages := .Page.Pages }} +{{- $pages := .Pages }} {{- $limit := .Site.Config.Services.RSS.Limit }} -{{- if ge $limit 0 }} +{{- if ge $limit 1 }} {{- $pages = $pages | first $limit }} {{- end }} + {{- $page := . }} {{- printf "" | safeHTML }} @@ -33,7 +34,7 @@ {{ . }}{{ with $authorName }} ({{ . }}){{ end }}{{ end }}{{ with $authorEmail }} {{ . }}{{ with $authorName }} ({{ . }}){{ end }}{{ end }}{{ with .Site.Copyright }} {{ . }}{{ end }}{{ if not .Date.IsZero }} - {{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}{{ end }} + {{ (index $pages.ByLastmod.Reverse 0).Lastmod.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}{{ end }} {{- with .OutputFormats.Get "rss" }} {{ printf "" ( partial "relLangPrettyUglyURL.hugo" (dict "to" . "abs" true)) .MediaType | safeHTML }} {{- end -}} @@ -43,10 +44,10 @@ {{ .Title }} {{ partial "relLangPrettyUglyURL.hugo" (dict "to" . "abs" true) }} - {{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }} + {{ .PublishDate.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }} {{- with $authorEmail }}{{ . }}{{ with $authorName }} ({{ . }}){{ end }}{{ end }} {{ partial "relLangPrettyUglyURL.hugo" (dict "to" . "abs" true) }} - {{ .Summary | html }} + {{ .Summary | transform.XMLEscape | safeHTML }} {{- end }} {{- end }}