bunteshaus.de/themes/buha/layouts/_default/rss.xml

57 lines
2.4 KiB
XML
Raw Normal View History

2021-10-23 22:20:01 +02:00
{{- $pctx := . -}}
{{- if .IsHome -}}{{ $pctx = .Site }}{{- end -}}
{{- $pages := slice -}}
{{- if or $.IsHome $.IsSection -}}
{{- $pages = $pctx.RegularPages -}}
{{- else -}}
{{- $pages = $pctx.Pages -}}
{{- end -}}
2021-10-23 23:04:01 +02:00
{{- if eq .Section "news" -}}
{{- $pages = where .Site.RegularPages "Type" "in" site.Params.mainSections -}}
{{- end -}}
2021-10-23 22:20:01 +02:00
{{- $limit := .Site.Config.Services.RSS.Limit -}}
{{- if ge $limit 1 -}}
{{- $pages = $pages | first $limit -}}
{{- end -}}
2022-04-04 13:26:09 +02:00
{{ $pages = $pages.ByLastmod.Reverse }}
2022-03-27 12:06:12 +02:00
{{- printf "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\"?>" | safeHTML }}
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
<channel>
2021-10-23 22:20:01 +02:00
<title>{{ .Site.Title }}</title>
<link>{{ .Permalink }}</link>
<description>Aktuelles von {{ .Site.Title }}</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>{{ .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 -}}
2022-04-04 13:26:09 +02:00
{{ range where $pages "Type" "in" .Site.Params.searchSections }}
2022-04-05 11:18:45 +02:00
{{ $when := .Params.when }}
{{ with $when }}
{{ $when }}
2022-04-05 11:05:52 +02:00
{{ end }}
2021-10-23 22:20:01 +02:00
<item>
<title>{{ .Title }}</title>
<link>{{ .Permalink }}</link>
2022-04-04 13:26:09 +02:00
<pubDate>{{ .Lastmod.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</pubDate>
2021-10-23 22:20:01 +02:00
{{ with .Site.Author.email }}<author>{{.}}{{ with $.Site.Author.name }} ({{.}}){{end}}</author>{{end}}
2022-04-04 13:26:09 +02:00
<guid>{{ .Permalink }}-{{ .Lastmod }}</guid>
2022-03-27 12:00:47 +02:00
<description>
2022-04-05 11:18:45 +02:00
{{ if $when }}{{ printf "<![CDATA[<p><b>%s</b></p>]]>" $when | safeHTML }}{{ end }}
2022-04-05 11:05:52 +02:00
2022-04-05 11:18:45 +02:00
{{ printf "<![CDATA[%s]]>" .Content | plainify }}
2022-03-27 12:00:47 +02:00
{{ $img := index (.Resources.ByType "image") 0 }}
{{ with $img }}
{{ $img := .Resize "640x" }}
2022-04-03 22:01:16 +02:00
{{ printf "<![CDATA[<img src=\"%s\" width=\"%d\" height=\"%d\"/>]]>" $img.Permalink $img.Width $img.Height | safeHTML }}
2022-03-27 12:00:47 +02:00
{{ end }}
</description>
2021-10-23 22:20:01 +02:00
</item>
{{ end }}
</channel>
</rss>