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

108 lines
4.2 KiB
XML
Raw Normal View History

2022-06-15 21:48:37 +02:00
{{- if or (.IsHome) (in .Site.Params.mainMenu .Section) -}}
{{- $title := .Site.Title -}}
{{- $desc := "" -}}
{{- $i18n_section := i18n "news" -}}
{{- if .IsHome -}}
{{- $desc = printf "Aktuelle Informationen vom %s" $title -}}
{{- $title = printf "%s: %s" $title $i18n_section -}}
{{ else if in .Site.Params.mainMenu .Section }}
{{- $desc = printf "Aktuelle Informationen vom %s" .Site.Title -}}
{{ $i18n_section = i18n .Section }}
{{- $title = printf "%s: %s" .Site.Title $i18n_section -}}
2021-10-23 22:20:01 +02:00
{{- end -}}
2022-06-15 21:48:37 +02:00
{{- $pages := where (where site.RegularPages "Permalink" "!=" .Permalink) "Type" "in" .Site.Params.searchSections -}}
{{- if eq .Section "events" -}}
{{- $pages = where $pages ".Params.when" "ne" nil -}}
2021-10-23 22:20:01 +02:00
{{- end -}}
2022-06-15 21:48:37 +02:00
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>
2022-06-15 21:48:37 +02:00
<title>{{ $title }}</title>
2021-10-23 22:20:01 +02:00
<link>{{ .Permalink }}</link>
2022-06-15 21:48:37 +02:00
<description>{{- $desc -}}</description>
2021-10-23 22:20:01 +02:00
<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-06-15 21:48:37 +02:00
{{ range $pages }}
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 }}
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-06-15 21:48:37 +02:00
{{- $c := .Content -}}
{{- $summary := "" -}}
{{- if in .RawContent "<!--more-->" -}}
{{- $tmp := split .RawContent "<!--more-->" -}}
{{- $c = index $tmp 0 | markdownify -}}
{{- else if $c -}}
{{- if hasPrefix .Summary "<p>" -}}
{{- $c = .Summary -}}
{{- else -}}
{{- $c = printf "<p>%s</p>" .Summary -}}
{{- end -}}
{{- end -}}
2022-06-15 21:59:25 +02:00
2022-06-15 21:48:37 +02:00
{{- $banner := .Resources.GetMatch "banner*" -}}
{{- if $banner -}}
2022-06-15 21:56:48 +02:00
{{- $c = printf "<img loading=\"lazy\" src=\"%s\" width=\"%d\" height=\"%d\" />%s" $banner.Permalink $banner.Width $banner.Height $c -}}
2022-04-05 12:11:15 +02:00
{{- end -}}
2022-06-15 21:48:37 +02:00
2022-06-15 21:59:25 +02:00
{{- if $when -}}
{{- $c = printf "<p><b>%s</b></p>%s" $when $c -}}
{{- end -}}
2022-06-15 21:48:37 +02:00
{{- range .Resources.ByType "image" -}}
2022-06-15 21:52:38 +02:00
{{ $img := . }}
{{- if not (hasPrefix $img.Name "banner") }}
2022-06-15 21:59:25 +02:00
{{- $c = printf "%s<img loading=\"lazy\" src=\"%s\" width=\"%d\" height=\"%d\" />" $c $img.Permalink $img.Width $img.Height -}}
2022-06-15 21:48:37 +02:00
{{- end -}}
{{- end -}}
{{- 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>
2022-06-15 21:48:37 +02:00
{{- end -}}