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

90 lines
3.7 KiB
XML
Raw Normal View History

2022-04-08 13:22:50 +02:00
{{- $posts := where (where .Site.RegularPages "Permalink" "!=" .Permalink) "Type" "in" .Site.Params.searchSections -}}
{{- $title := lower .Title -}}
{{- $pages := slice -}}
2021-10-23 22:20:01 +02:00
{{- $pctx := . -}}
{{- if .IsHome -}}{{ $pctx = .Site }}{{- end -}}
{{- if or $.IsHome $.IsSection -}}
{{- $pages = $pctx.RegularPages -}}
{{- else -}}
2022-04-08 13:22:50 +02:00
{{- $what := printf ".Params.%s" $title -}}
{{- if or (eq $title "about") (eq $title "featured") -}}
{{- $pages = where $posts $what "eq" true -}}
{{- else if or (eq $title "tags") (eq $title "categories") -}}
{{- $pages = $posts -}}
{{- else if eq $title "events" -}}
{{- $pages = where $posts ".Params.when" "ne" nil -}}
{{- else -}}
{{- $pages = .Data.Pages -}}
{{- end -}}
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-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-05 12:49:50 +02:00
{{- $img := .Resize "640x" -}}
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-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>