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

129 lines
5.0 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" -}}
2022-06-15 22:13:03 +02:00
2022-06-15 21:48:37 +02:00
{{- if .IsHome -}}
2022-06-15 22:13:03 +02:00
{{- $desc = printf "Aktuelle Informationen vom %s" $title -}}
{{- $title = printf "%s: %s" $title $i18n_section -}}
2022-06-22 20:29:07 +02:00
{{- else if in .Site.Params.mainMenu .Section -}}
2022-06-15 22:13:03 +02:00
{{- $desc = printf "Aktuelle Informationen vom %s" .Site.Title -}}
2022-06-22 20:29:07 +02:00
{{- $i18n_section = i18n .Section -}}
2022-06-15 22:13:03 +02:00
{{- $title = printf "%s: %s" .Site.Title $i18n_section -}}
2021-10-23 22:20:01 +02:00
{{- end -}}
2022-06-15 22:13:03 +02:00
2022-06-22 20:29:07 +02:00
{{- $pages := where .Site.RegularPages "Section" "in" .Site.Params.searchSections -}}
2022-06-15 21:48:37 +02:00
{{- if eq .Section "events" -}}
2022-06-15 22:13:03 +02:00
{{- $pages = where $pages ".Params.when" "ne" nil -}}
2022-06-22 20:29:07 +02:00
{{- else if eq .Section "about" -}}
{{- $pages = where $pages ".Params.about" "ne" nil -}}
{{- else if eq .Section "featured" -}}
{{- $pages = where $pages ".Params.featured" "ne" nil -}}
{{- else if eq .Section "tags" -}}
{{- $pages = where $pages ".Params.tags" "ne" nil -}}
2021-10-23 22:20:01 +02:00
{{- end -}}
2022-06-15 22:13:03 +02:00
2022-06-22 20:29:07 +02:00
{{- printf "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\"?>" | safeHTML -}}
2022-03-27 12:06:12 +02:00
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
2022-06-15 22:13:03 +02:00
<channel>
2022-06-22 20:29:07 +02:00
<title>{{- .Site.Title -}}</title>
<link>{{- .Permalink -}}</link>
2022-06-15 22:13:03 +02:00
<description>{{- $desc -}}</description>
2022-06-22 20:29:07 +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 -}}
2022-06-15 22:13:03 +02:00
{{- with .OutputFormats.Get "RSS" -}}
2022-06-22 20:29:07 +02:00
{{- printf "<atom:link href=%q rel=\"self\" type=%q />" .Permalink .MediaType | safeHTML -}}
2022-06-15 22:13:03 +02:00
{{- end -}}
2022-06-22 20:29:07 +02:00
{{- range $pages -}}
{{- if or (eq .Lastmod .Date) (gt .Lastmod (.Date.AddDate 0 0 -1)) -}}
{{- $when := .Params.when -}}
{{- $about := .Params.about -}}
{{- $covid := .Params.covid -}}
{{- $contact := .Params.contact -}}
{{- $price := .Params.price -}}
{{- $featured := .Params.featured -}}
{{- $categories := slice -}}
{{- range .Params.categories -}}
{{- $categories = $categories | append . -}}
{{- end -}}
{{- $events := slice -}}
{{- range .Params.events -}}
{{- $events = $events | append . -}}
{{- end -}}
{{- $tags := slice -}}
{{- range .Params.tags -}}
{{- $tags = $tags | append . -}}
{{- end -}}
{{- $images := slice -}}
{{- $hash := slice $when $about $categories $events $covid $contact $price $featured $tags .Date .Lastmod .Title .Content -}}
{{- $hash = delimit $hash ", " -}}
{{- $hash = md5 $hash -}}
2022-06-15 22:13:03 +02:00
<item>
2022-06-15 23:23:56 +02:00
<title>
2022-06-22 20:29:07 +02:00
{{- if .Params.events -}}
{{- index .Params.events 0 -}}:
{{- else if .Params.recurrent -}}
2022-06-22 21:06:54 +02:00
{{- if i18n "recurrent" -}}
{{- i18n "recurrent" -}}:
2022-06-22 20:29:07 +02:00
{{- else -}}
2022-06-22 21:06:54 +02:00
{{- "Recurrent" -}}:
2022-06-22 20:29:07 +02:00
{{- end -}}
{{- else if .Params.categories -}}
{{- if in .Params.categories "Buha" -}}
2022-06-15 23:23:56 +02:00
In eigener Sache:
2022-06-22 20:29:07 +02:00
{{- end -}}
2022-06-22 21:06:54 +02:00
{{- end }}
2022-06-22 21:05:51 +02:00
{{ .Title -}}
2022-06-15 23:23:56 +02:00
</title>
2022-06-22 20:29:07 +02:00
<link>{{- .Permalink -}}</link>
<pubDate>{{- .Lastmod.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML -}}</pubDate>
{{- with .Site.Author.email -}}<author>{{.}}{{- with $.Site.Author.name -}} ({{.}}){{end}}</author>{{end}}
<guid>{{- .Permalink -}}-{{- $hash -}}</guid>
2022-06-15 22:13:03 +02:00
<description>
{{- $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 -}}
{{- $banner := .Resources.GetMatch "banner*" -}}
{{- if $banner -}}
2022-06-15 22:23:00 +02:00
{{- $c = printf "<p style=\"width: 65%s;\"><img loading=\"lazy\" src=\"%s\" width=\"%d\" height=\"%d\" /></p>%s" "%" $banner.Permalink $banner.Width $banner.Height $c -}}
2022-06-15 22:13:03 +02:00
{{- end -}}
{{- if $when -}}
{{- $c = printf "<p><b>%s</b></p>%s" $when $c -}}
{{- end -}}
{{- range .Resources.ByType "image" -}}
{{- $img := . -}}
{{- if not (hasPrefix $img.Name "banner") -}}
2022-06-15 22:23:00 +02:00
{{- $c = printf "%s<p style=\"width: 65%s;\"><img loading=\"lazy\" src=\"%s\" width=\"%d\" height=\"%d\" /></p>" $c "%" $img.Permalink $img.Width $img.Height -}}
2022-06-15 22:13:03 +02:00
{{- end -}}
{{- end -}}
{{- printf "<![CDATA[%s]]>" $c | safeHTML -}}
{{- end -}}
</description>
</item>
2022-06-22 20:29:07 +02:00
{{- end -}}
2022-06-15 22:13:03 +02:00
</channel>
2022-04-06 19:32:09 +02:00
</rss>
2022-06-15 21:48:37 +02:00
{{- end -}}