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

89 lines
3.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 -}}
{{- $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 }}
2022-04-05 11:50:58 +02:00
{{ $about := .Params.about }}
{{ $covid := .Params.covid }}
{{ $registeremail := .Params.registeremail }}
{{ $price := .Params.price }}
{{ $featured := .Params.featured }}
{{ $categories := slice }}
{{ range .Params.categories }}
{{ $categories = $categories | append . }}
2022-04-05 11:05:52 +02:00
{{ end }}
2022-04-05 11:50:58 +02:00
{{ $events := slice }}
{{ range .Params.events }}
{{ $events = $events | append . }}
{{ end }}
{{ $tags := slice }}
{{ range .Params.tags }}
{{ $tags = $tags | append . }}
{{ end }}
{{ $hash := slice $when $about $categories $events $covid $registeremail $price $price $featured $tags .Date .Lastmod .Title .Content }}
{{ $hash = delimit $hash ", " }}
{{ $hash = md5 $hash }}
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-05 11:50:58 +02:00
<guid>{{ .Permalink }}-{{ $hash }}</guid>
2022-03-27 12:00:47 +02:00
<description>
2022-04-05 12:49:50 +02:00
{{ $updated := "" }}
2022-04-05 12:54:49 +02:00
{{ if gt .Lastmod.Unix .Date.Unix }}
2022-04-05 12:49:50 +02:00
{{ $updated = i18n "updated" }}
{{ end }}
{{- if $when -}}
{{- $when = $when -}}
{{- end -}}
2022-04-05 12:14:15 +02:00
{{- $c := .Content -}}
2022-04-05 12:33:01 +02:00
{{- $c := replace $c "<img" "<img width=\"600\"" -}}
2022-04-05 12:49:50 +02:00
{{- if $when -}}
{{- $c = printf "<p>%s</p>%s" $when $c -}}
{{- end -}}
{{- if ne $updated "" -}}
{{- $c = printf "<p>%s</p>%s" $updated $c -}}
{{- end -}}
2022-04-05 12:11:15 +02:00
{{- $img := index (.Resources.ByType "image") 0 -}}
{{- with $img -}}
2022-04-05 12:49:50 +02:00
{{- $img := .Resize "640x" -}}
{{- printf "<![CDATA[%s<img src=\"%s\" width=\"%d\" height=\"%d\"/>]]>" $c $img.Permalink $img.Width $img.Height | safeHTML -}}
{{ else }}
{{- printf "<![CDATA[%s]]>" $c | safeHTML -}}
2022-04-05 12:11:15 +02:00
{{- end -}}
2022-03-27 12:00:47 +02:00
</description>
2021-10-23 22:20:01 +02:00
</item>
{{ end }}
</channel>
</rss>