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