rss.xml (3016B)
1 {{- $authorEmail := "" }} 2 {{- with site.Params.author }} 3 {{- if reflect.IsMap . }} 4 {{- with .email }} 5 {{- $authorEmail = . }} 6 {{- end }} 7 {{- end }} 8 {{- end }} 9 10 {{- $authorName := "" }} 11 {{- with site.Params.author }} 12 {{- if reflect.IsMap . }} 13 {{- with .name }} 14 {{- $authorName = . }} 15 {{- end }} 16 {{- else }} 17 {{- $authorName = . }} 18 {{- end }} 19 {{- end }} 20 21 {{- $pctx := . }} 22 {{- if .IsHome }}{{ $pctx = site }}{{ end }} 23 {{- $pages := slice }} 24 {{- if or $.IsHome $.IsSection }} 25 {{- $pages = $pctx.RegularPages }} 26 {{- else }} 27 {{- $pages = $pctx.Pages }} 28 {{- end }} 29 {{- $pages = where $pages "Params.hiddenInRss" "!=" true -}} 30 {{- $limit := site.Config.Services.RSS.Limit }} 31 {{- if ge $limit 1 }} 32 {{- $pages = $pages | first $limit }} 33 {{- end }} 34 {{- printf "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\"?>" | safeHTML }} 35 <rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/"> 36 <channel> 37 <title>{{ if eq .Title site.Title }}{{ site.Title }}{{ else }}{{ with .Title }}{{ . }} on {{ end }}{{ site.Title }}{{ end }}</title> 38 <link>{{ .Permalink }}</link> 39 <description>Recent content {{ if ne .Title site.Title }}{{ with .Title }}in {{ . }} {{ end }}{{ end }}on {{ site.Title }}</description> 40 {{- with site.Params.images }} 41 <image> 42 <title>{{ site.Title }}</title> 43 <url>{{ index . 0 | absURL }}</url> 44 <link>{{ index . 0 | absURL }}</link> 45 </image> 46 {{- end }} 47 <generator>Hugo</generator> 48 <language>{{ site.Language.LanguageCode }}</language>{{ with $authorEmail }} 49 <managingEditor>{{.}}{{ with $authorName }} ({{ . }}){{ end }}</managingEditor>{{ end }}{{ with $authorEmail }} 50 <webMaster>{{ . }}{{ with $authorName }} ({{ . }}){{ end }}</webMaster>{{ end }}{{ with site.Copyright }} 51 <copyright>{{ . | markdownify | plainify | strings.TrimPrefix "© " }}</copyright>{{ end }}{{ if not .Date.IsZero }} 52 <lastBuildDate>{{ (index $pages.ByLastmod.Reverse 0).Lastmod.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</lastBuildDate>{{ end }} 53 {{- with .OutputFormats.Get "RSS" }} 54 {{ printf "<atom:link href=%q rel=\"self\" type=%q />" .Permalink .MediaType | safeHTML }} 55 {{- end }} 56 {{- range $pages }} 57 {{- if and (ne .Layout `search`) (ne .Layout `archives`) }} 58 <item> 59 <title>{{ .Title }}</title> 60 <link>{{ .Permalink }}</link> 61 <pubDate>{{ .PublishDate.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</pubDate> 62 {{- with $authorEmail }}<author>{{ . }}{{ with $authorName }} ({{ . }}){{ end }}</author>{{ end }} 63 <guid>{{ .Permalink }}</guid> 64 <description>{{ with .Description | html }}{{ . }}{{ else }}{{ .Summary | html }}{{ end -}}</description> 65 {{- if and site.Params.ShowFullTextinRSS .Content }} 66 <content:encoded>{{ (printf "<![CDATA[%s]]>" .Content) | safeHTML }}</content:encoded> 67 {{- end }} 68 </item> 69 {{- end }} 70 {{- end }} 71 </channel> 72 </rss>