small fixes

This commit is contained in:
teldra 2022-06-15 22:11:14 +02:00
parent 3da842c761
commit acb468f46e

View File

@ -2,7 +2,6 @@
{{- $title := .Site.Title -}} {{- $title := .Site.Title -}}
{{- $desc := "" -}} {{- $desc := "" -}}
{{- $i18n_section := i18n "news" -}} {{- $i18n_section := i18n "news" -}}
{{- 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 -}}
@ -11,14 +10,10 @@
{{ $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 (where site.RegularPages "Permalink" "!=" .Permalink) "Type" "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 -}}
{{- 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>
@ -58,7 +53,6 @@
{{ $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 }}</title> <title>{{ .Title }}</title>
<link>{{ .Permalink }}</link> <link>{{ .Permalink }}</link>
@ -67,7 +61,6 @@
<guid>{{ .Permalink }}-{{ $hash }}</guid> <guid>{{ .Permalink }}-{{ $hash }}</guid>
<description> <description>
{{- $c := .Content -}} {{- $c := .Content -}}
{{- $summary := "" -}} {{- $summary := "" -}}
{{- if in .RawContent "<!--more-->" -}} {{- if in .RawContent "<!--more-->" -}}
{{- $tmp := split .RawContent "<!--more-->" -}} {{- $tmp := split .RawContent "<!--more-->" -}}
@ -79,27 +72,22 @@
{{- $c = printf "<p>%s</p>" .Summary -}} {{- $c = printf "<p>%s</p>" .Summary -}}
{{- end -}} {{- end -}}
{{- end -}} {{- end -}}
{{- $banner := .Resources.GetMatch "banner*" -}} {{- $banner := .Resources.GetMatch "banner*" -}}
{{- if $banner -}} {{- if $banner -}}
{{- $c = printf "<p><img loading=\"lazy\" src=\"%s\" width=\"%d\" height=\"%d\" /></p>%s" $banner.Permalink $banner.Width $banner.Height $c -}} {{- $c = printf "<p><img loading=\"lazy\" src=\"%s\" width=\"%d\" height=\"%d\" /></p>%s" $banner.Permalink $banner.Width $banner.Height $c -}}
{{- end -}} {{- end -}}
{{- if $when -}} {{- if $when -}}
{{- $c = printf "<p><b>%s</b></p>%s" $when $c -}} {{- $c = printf "<p><b>%s</b></p>%s" $when $c -}}
{{- end -}} {{- end -}}
{{- range .Resources.ByType "image" -}} {{- range .Resources.ByType "image" -}}
{{- $img := . -}} {{- $img := . -}}
{{- if not (hasPrefix $img.Name "banner") -}} {{- if not (hasPrefix $img.Name "banner") -}}
{{- $c = printf "%s<p><img loading=\"lazy\" src=\"%s\" width=\"%d\" height=\"%d\" /></p>" $c $img.Permalink $img.Width $img.Height -}} {{- $c = printf "%s<p><img loading=\"lazy\" src=\"%s\" width=\"%d\" height=\"%d\" /></p>" $c $img.Permalink $img.Width $img.Height -}}
{{- end -}} {{- end -}}
{{- end -}} {{- end -}}
{{- printf "<![CDATA[%s]]>" ($c | safeHTML) -}} {{- printf "<![CDATA[%s]]>" ($c | safeHTML) -}}
{{- end -}} {{- end -}}
</description> </description>
</item> </item>
{{ end }} {{ end }}
</channel> </channel>