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