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

78 lines
3.3 KiB
XML
Raw Normal View History

2022-04-08 17:21:11 +02:00
{{- $pages := where (where .Site.RegularPages "Permalink" "!=" .Permalink) "Type" "in" .Site.Params.searchSections -}}
2022-04-08 13:22:50 +02:00
{{- $title := lower .Title -}}
2022-04-28 18:11:33 +02:00
{{- if eq .Section "events" -}}
2022-04-08 17:21:11 +02:00
{{- $pages = where $pages ".Params.when" "ne" nil -}}
2021-10-23 22:20:01 +02:00
{{- end -}}
{{- $limit := .Site.Config.Services.RSS.Limit -}}
{{- if ge $limit 1 -}}
{{- $pages = $pages | first $limit -}}
{{- end -}}
2022-04-08 13:22:50 +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-09 21:34:04 +02:00
{{ if or (eq .Lastmod .Date) (gt .Lastmod (.Date.AddDate 0 0 -1)) }}
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 }}
2022-04-06 19:32:09 +02:00
{{ $contact := .Params.contact }}
2022-04-05 11:50:58 +02:00
{{ $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 }}
2022-04-05 14:49:37 +02:00
{{ $images := slice }}
{{ range .Resources.ByType "image" }}
{{ $images = $images | append . }}
{{ end }}
2022-04-06 19:32:09 +02:00
{{ $hash := slice $when $about $categories $events $covid $contact $price $featured $tags .Date .Lastmod .Title .Content }}
2022-04-05 11:50:58 +02:00
{{ $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 14:49:37 +02:00
{{- $c := replace .Content "<img" "<img width=\"600\"" -}}
2022-04-05 12:49:50 +02:00
{{- if $when -}}
2022-04-05 13:58:27 +02:00
{{- $c = printf "<p><b>%s</b></p>%s" $when $c -}}
2022-04-05 12:49:50 +02:00
{{- end -}}
2022-04-05 12:11:15 +02:00
{{- $img := index (.Resources.ByType "image") 0 -}}
{{- with $img -}}
2022-04-28 18:11:33 +02:00
{{- $img := .Resize "500x" -}}
2022-04-05 14:49:37 +02:00
{{- $c = printf "%s<img src=\"%s\" width=\"%d\" height=\"%d\" />" $c $img.Permalink $img.Width $img.Height -}}
2022-04-05 12:11:15 +02:00
{{- end -}}
2022-04-05 14:49:37 +02:00
{{- printf "<![CDATA[%s]]>" $c | safeHTML -}}
2022-04-09 21:34:04 +02:00
{{- end -}}
2022-03-27 12:00:47 +02:00
</description>
2021-10-23 22:20:01 +02:00
</item>
{{ end }}
</channel>
2022-04-06 19:32:09 +02:00
</rss>