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