small fixes

This commit is contained in:
teldra 2022-06-15 22:13:03 +02:00
parent acb468f46e
commit 7ce041fa4b
1 changed files with 93 additions and 81 deletions

View File

@ -2,6 +2,7 @@
{{- $title := .Site.Title -}}
{{- $desc := "" -}}
{{- $i18n_section := i18n "news" -}}
{{- if .IsHome -}}
{{- $desc = printf "Aktuelle Informationen vom %s" $title -}}
{{- $title = printf "%s: %s" $title $i18n_section -}}
@ -10,10 +11,14 @@
{{ $i18n_section = i18n .Section }}
{{- $title = printf "%s: %s" .Site.Title $i18n_section -}}
{{- end -}}
{{- $pages := where (where site.RegularPages "Permalink" "!=" .Permalink) "Type" "in" .Site.Params.searchSections -}}
{{- if eq .Section "events" -}}
{{- $pages = where $pages ".Params.when" "ne" nil -}}
{{- end -}}
{{- printf "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\"?>" | safeHTML }}
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
<channel>
@ -53,6 +58,7 @@
{{ $hash := slice $when $about $categories $events $covid $contact $price $featured $tags .Date .Lastmod .Title .Content }}
{{ $hash = delimit $hash ", " }}
{{ $hash = md5 $hash }}
<item>
<title>{{ .Title }}</title>
<link>{{ .Permalink }}</link>
@ -61,6 +67,7 @@
<guid>{{ .Permalink }}-{{ $hash }}</guid>
<description>
{{- $c := .Content -}}
{{- $summary := "" -}}
{{- if in .RawContent "<!--more-->" -}}
{{- $tmp := split .RawContent "<!--more-->" -}}
@ -72,22 +79,27 @@
{{- $c = printf "<p>%s</p>" .Summary -}}
{{- end -}}
{{- end -}}
{{- $banner := .Resources.GetMatch "banner*" -}}
{{- if $banner -}}
{{- $c = printf "<p><img loading=\"lazy\" src=\"%s\" width=\"%d\" height=\"%d\" /></p>%s" $banner.Permalink $banner.Width $banner.Height $c -}}
{{- 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") -}}
{{- $c = printf "%s<p><img loading=\"lazy\" src=\"%s\" width=\"%d\" height=\"%d\" /></p>" $c $img.Permalink $img.Width $img.Height -}}
{{- end -}}
{{- end -}}
{{- printf "<![CDATA[%s]]>" ($c | safeHTML) -}}
{{- printf "<![CDATA[%s]]>" $c | safeHTML -}}
{{- end -}}
</description>
</item>
{{ end }}
</channel>