brainbaking/themes/brainbaking-minimal/layouts/_default/rss.xml

70 lines
2.8 KiB
XML

{{- $allowedRssSections := (slice "post" "notes") -}}
{{- $baseurl := .Site.BaseURL -}}
{{- $pctx := . -}}
{{- if .IsHome -}}{{ $pctx = .Site }}{{- end -}}
{{- $pages := slice -}}
{{- if or $.IsHome $.IsSection -}}
{{- $pages = $pctx.RegularPages -}}
{{- else -}}
{{- $pages = $pctx.Pages -}}
{{- end -}}
{{- $limit := .Site.Config.Services.RSS.Limit -}}
{{- if ge $limit 1 -}}
{{- $pages = $pages | first $limit -}}
{{- end -}}
{{- printf "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\"?>" | safeHTML }}
{{- printf "<?xml-stylesheet href=\"/pretty-feed-v3.xsl\" type=\"text/xsl\"?>" | safeHTML }}
<rss version='2.0' xmlns:content='http://purl.org/rss/1.0/modules/content/' xmlns:atom='http://www.w3.org/2005/Atom'>
<channel>
<title>{{ if eq .Title .Site.Title }}{{ .Site.Title }}{{ else }}{{ with .Title }}{{.}} on {{ end }}{{ .Site.Title }}{{ end }}</title>
<link>{{ .Permalink }}</link>
<description>Recent content {{ if ne .Title .Site.Title }}{{ with .Title }}in {{.}} {{ end }}{{ end }}on {{ .Site.Title }}</description>
<generator>Hugo -- gohugo.io</generator>{{ with .Site.LanguageCode }}
<language>{{.}}</language>{{end}}
<managingEditor>{{ with $.Site.Author.name }}{{.}}{{end}}</managingEditor>
<webMaster>{{ with $.Site.Author.name }}{{.}}{{end}}</webMaster>{{ with .Site.Copyright }}
<copyright>{{.}}</copyright>{{end}}{{ if not .Date.IsZero }}
<lastBuildDate>{{ .Date.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 in $allowedRssSections .Section }}
<item>
<title>{{ .Title }}</title>
<link>{{ .Permalink }}</link>
<comments>{{ .Site.Author.mastodonlink }}</comments>
<pubDate>{{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</pubDate>
<author>{{ with $.Site.Author.name }}{{.}}{{end}}</author>
<guid isPermaLink="true">{{ .Permalink }}</guid>
{{ if .Keywords }}
{{ range .Keywords }}
<category>{{ . }}</category>
{{ end }}
{{ else if .Params.tags }}
{{ range .Params.tags }}
<category domain="{{ $baseurl }}tags/{{ . }}">{{ . }}</category>
{{ end }}
{{ end }}
{{ $content := .Content | safeHTML }}
<description>
{{ `<![CDATA[ ` | safeHTML }}
{{ if .Params.bigimg }}
<p>
<img align="left" hspace="5" src="{{ $baseurl }}bigimg/{{ .Params.bigimg }}"/>
</p>
{{ end }}
{{ $content }}
<p>
By <a href="/about">{{ .Site.Author.name }}</a> on {{ .Date.Format "2 January 2006" }}.
</p>
]]>
</description>
</item>
{{ end }}
{{ end }}
</channel>
</rss>