Commit 1008665b authored by Laura Kalbag's avatar Laura Kalbag

Improve RSS feed output

Its permalinks now lead to the original event URL or news URL, and the descriptions display relevant content depending on whether its an event or a News item.
parent 3af73c52
{{- $pages := "" -}}
{{- if .IsHome -}}{{- $pages = .Site.RegularPages -}}{{- else -}}{{- $pages = .Pages -}}{{- end -}}
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
<channel>
<title>{{ .Site.Title }}’s {{ if eq .Type "events" }}Events{{ else if eq .Type "news" }}News{{ else if eq .Title "Home" }}News and Events{{ end }}</title>
<link>{{ .Permalink }}</link>
<description>{{ if eq .Title "Home" }}All the recent{{ else }}Recent{{ end }} {{ if eq .Type "events" }}events {{ else if eq .Type "news" }}news {{ else }}posts {{ end }}from Small Technology Foundation</description>
<generator>Hugo -- gohugo.io</generator>{{ with .Site.LanguageCode }}
<language>{{.}}</language>{{end}}{{ with .Site.Author.email }}
<managingEditor>{{.}}{{ with $.Site.Author.name }} ({{.}}){{end}}</managingEditor>{{end}}{{ with .Site.Author.email }}
<webMaster>{{.}}{{ with $.Site.Author.name }} ({{.}}){{end}}</webMaster>{{end}}{{ with .Site.Copyright }}
<copyright>{{.}}</copyright>{{end}}{{ if not .Date.IsZero }}
<lastBuildDate>{{ now.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</lastBuildDate>{{ end }}
{{ with .OutputFormats.Get "RSS" }}
{{ printf "<atom:link href=%q rel=\"self\" type=%q />" .Permalink .MediaType | safeHTML }}
{{ end }}
{{ range $pages }}
{{ if eq .Type "events" }}
<item>
<title>Upcoming event: {{ .Title }}</title>
<link>{{ .Params.eventURL }}</link>
<pubDate>{{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</pubDate>
{{ with .Params.speaker }}<author>{{.}}</author>{{end}}
<guid>{{ .Params.eventURL }}</guid>
<description>&lt;p&gt;&lt;On {{ .Date.Format "2" | humanize }} {{ .Date.Format "January, 2006" }} in {{ .Params.eventCity }}, {{ .Params.eventCountry }}:&lt;/p&gt;{{ .Content | html }}&lt;p&gt;&lt;a href=&#34;{{ .Params.eventURL }}&#34;&gt;Visit the {{ .Title }} event website&lt;/a&gt;.&lt;/p&gt;</description>
</item>
{{ else }}
<item>
<title>{{ .Title }}</title>
<link>{{ .Params.postURL }}</link>
<pubDate>{{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</pubDate>
{{ with .Site.Author.email }}<author>{{.}}{{ with .Params.writer }} ({{.}}){{end}}</author>{{end}}
<guid>{{ .Params.postURL }}</guid>
<description>&lt;blockquote&gt;&lt;{{ .Content | html }}&lt;/blockquote&gt;&lt;p&gt;&lt;a href=&#34;{{ .Params.postURL }}&#34;&gt;Read &#39;{{ .Title }}&#39; on {{ .Params.SourceName }}&lt;/a&gt;.&lt;/p&gt;</description>
</item>
{{ end }}
{{ end }}
</channel>
</rss>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment