small fixes

This commit is contained in:
teldra 2022-06-22 20:29:07 +02:00
parent f5d4a30def
commit 67e6b1f019
1 changed files with 61 additions and 55 deletions

View File

@ -6,80 +6,86 @@
{{- if .IsHome -}} {{- if .IsHome -}}
{{- $desc = printf "Aktuelle Informationen vom %s" $title -}} {{- $desc = printf "Aktuelle Informationen vom %s" $title -}}
{{- $title = printf "%s: %s" $title $i18n_section -}} {{- $title = printf "%s: %s" $title $i18n_section -}}
{{ else if in .Site.Params.mainMenu .Section }} {{- else if in .Site.Params.mainMenu .Section -}}
{{- $desc = printf "Aktuelle Informationen vom %s" .Site.Title -}} {{- $desc = printf "Aktuelle Informationen vom %s" .Site.Title -}}
{{ $i18n_section = i18n .Section }} {{- $i18n_section = i18n .Section -}}
{{- $title = printf "%s: %s" .Site.Title $i18n_section -}} {{- $title = printf "%s: %s" .Site.Title $i18n_section -}}
{{- end -}} {{- end -}}
{{- $pages := where (where site.RegularPages "Permalink" "!=" .Permalink) "Type" "in" .Site.Params.searchSections -}} {{- $pages := where .Site.RegularPages "Section" "in" .Site.Params.searchSections -}}
{{- if eq .Section "events" -}} {{- if eq .Section "events" -}}
{{- $pages = where $pages ".Params.when" "ne" nil -}} {{- $pages = where $pages ".Params.when" "ne" nil -}}
{{- 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 -}}
{{- end -}} {{- end -}}
{{- printf "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\"?>" | safeHTML }} {{- printf "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\"?>" | safeHTML -}}
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"> <rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
<channel> <channel>
<title>{{ .Site.Title }}</title> <title>{{- .Site.Title -}}</title>
<link>{{ .Permalink }}</link> <link>{{- .Permalink -}}</link>
<description>{{- $desc -}}</description> <description>{{- $desc -}}</description>
<generator>Hugo -- gohugo.io</generator>{{ with .Site.LanguageCode }} <generator>Hugo -- gohugo.io</generator>{{- with .Site.LanguageCode -}}
<language>{{.}}</language>{{end}}{{ with .Site.Author.email }} <language>{{.}}</language>{{end}}{{- with .Site.Author.email -}}
<managingEditor>{{.}}{{ with $.Site.Author.name }} ({{.}}){{end}}</managingEditor>{{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 }} <webMaster>{{.}}{{- with $.Site.Author.name -}} ({{.}}){{end}}</webMaster>{{end}}{{- with .Site.Copyright -}}
<copyright>{{.}}</copyright>{{end}}{{ if not .Date.IsZero }} <copyright>{{.}}</copyright>{{end}}{{- if not .Date.IsZero -}}
<lastBuildDate>{{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</lastBuildDate>{{ end }} <lastBuildDate>{{- .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML -}}</lastBuildDate>{{- end -}}
{{- with .OutputFormats.Get "RSS" -}} {{- with .OutputFormats.Get "RSS" -}}
{{ printf "<atom:link href=%q rel=\"self\" type=%q />" .Permalink .MediaType | safeHTML }} {{- printf "<atom:link href=%q rel=\"self\" type=%q />" .Permalink .MediaType | safeHTML -}}
{{- end -}} {{- end -}}
{{ range $pages }} {{- range $pages -}}
{{ if or (eq .Lastmod .Date) (gt .Lastmod (.Date.AddDate 0 0 -1)) }} {{- if or (eq .Lastmod .Date) (gt .Lastmod (.Date.AddDate 0 0 -1)) -}}
{{ $when := .Params.when }} {{- $when := .Params.when -}}
{{ $about := .Params.about }} {{- $about := .Params.about -}}
{{ $covid := .Params.covid }} {{- $covid := .Params.covid -}}
{{ $contact := .Params.contact }} {{- $contact := .Params.contact -}}
{{ $price := .Params.price }} {{- $price := .Params.price -}}
{{ $featured := .Params.featured }} {{- $featured := .Params.featured -}}
{{ $categories := slice }} {{- $categories := slice -}}
{{ range .Params.categories }} {{- range .Params.categories -}}
{{ $categories = $categories | append . }} {{- $categories = $categories | append . -}}
{{ end }} {{- end -}}
{{ $events := slice }} {{- $events := slice -}}
{{ range .Params.events }} {{- range .Params.events -}}
{{ $events = $events | append . }} {{- $events = $events | append . -}}
{{ end }} {{- end -}}
{{ $tags := slice }} {{- $tags := slice -}}
{{ range .Params.tags }} {{- range .Params.tags -}}
{{ $tags = $tags | append . }} {{- $tags = $tags | append . -}}
{{ end }} {{- end -}}
{{ $images := slice }} {{- $images := slice -}}
{{ $hash := slice $when $about $categories $events $covid $contact $price $featured $tags .Date .Lastmod .Title .Content }} {{- $hash := slice $when $about $categories $events $covid $contact $price $featured $tags .Date .Lastmod .Title .Content -}}
{{ $hash = delimit $hash ", " }} {{- $hash = delimit $hash ", " -}}
{{ $hash = md5 $hash }} {{- $hash = md5 $hash -}}
<item> <item>
<title> <title>
{{ if .Params.events }} {{- if .Params.events -}}
{{ index .Params.events 0 }}: {{- index .Params.events 0 -}}:
{{ else if .Params.recurrent }} {{- else if .Params.recurrent -}}
{{ if i18n "recurrent"}} {{- if i18n "recurrent"}}
{{ i18n "recurrent"}}: {{- i18n "recurrent"}}:
{{ else }} {{- else -}}
{{ "Recurrent"}}: {{- "Recurrent"}}:
{{ end }} {{- end -}}
{{ else if .Params.categories }} {{- else if .Params.categories -}}
{{ if in .Params.categories "Buha" }} {{- if in .Params.categories "Buha" -}}
In eigener Sache: In eigener Sache:
{{ end }} {{- end -}}
{{ end }} {{- end -}}
{{ .Title }} {{- .Title -}}
</title> </title>
<link>{{ .Permalink }}</link> <link>{{- .Permalink -}}</link>
<pubDate>{{ .Lastmod.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</pubDate> <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}} {{- with .Site.Author.email -}}<author>{{.}}{{- with $.Site.Author.name -}} ({{.}}){{end}}</author>{{end}}
<guid>{{ .Permalink }}-{{ $hash }}</guid> <guid>{{- .Permalink -}}-{{- $hash -}}</guid>
<description> <description>
{{- $c := .Content -}} {{- $c := .Content -}}
@ -116,7 +122,7 @@
</description> </description>
</item> </item>
{{ end }} {{- end -}}
</channel> </channel>
</rss> </rss>
{{- end -}} {{- end -}}