bunteshaus.de/themes/buha/layouts/_default/list.atom.xml

49 lines
2.2 KiB
XML

{{- $pages := where .Site.RegularPages "Section" "in" .Site.Params.searchSections -}}
{{ if eq .Section "events" }}
{{- $pages = where $pages ".Params.when" "ne" nil -}}
{{ else if eq .Section "recurrent" }}
{{- $pages = where $pages ".Params.recurrent" "ne" nil -}}
{{ else if eq .Section "featured" }}
{{- $pages = where $pages ".Params.featured" "ne" nil -}}
{{ else if eq .Section "about" }}
{{- $pages = where $pages ".Params.about" "ne" nil -}}
{{ end }}
{{- $limit := .Site.Config.Services.RSS.Limit -}}
{{- if ge $limit 1 -}}
{{- $pages = $pages | first $limit -}}
{{- end -}}
<feed xmlns="http://www.w3.org/2005/Atom">
<title>{{ if eq .Title .Site.Title }}{{ .Site.Title }}{{ else }}{{ .Site.Title }}{{ with .Title }} - {{ if i18n "category" }}{{ i18n "category" }}{{ else }}{{ "Category" }}{{ end -}}: {{.}}{{ end }}{{ end }}</title>
<link href="{{ .Permalink }}index.xml" rel="self"/>
<link href="{{ .Permalink }}"/>{{ if not .Date.IsZero }}
<updated>{{ .Date.Format "2006-01-02T15:04:05-07:00" | safeHTML }}</updated>{{ end }}
<id>{{ .Permalink }}</id>{{ with .Site.Author.name }}
<author>
<name>{{.}}</name>{{ with $.Site.Author.email }}
<email>{{.}}</email>{{end}}
</author>{{end}}
<generator>Hugo -- gohugo.io</generator>{{ range $pages.ByLastmod.Reverse }}
<entry>
{{ `<title type="html"><![CDATA[` | safeHTML }}{{ .Title }}]]></title>
<link href="{{ .Permalink }}"/>
<id>{{ .Permalink }}</id>{{ with $.Site.Author.name }}
<author>
<name>{{.}}</name>
</author>{{end}}
<published>{{ .Date.Format "2006-01-02T15:04:05-07:00" | safeHTML }}</published>
<updated>{{ .Lastmod.Format "2006-01-02T15:04:05-07:00" | safeHTML }}</updated>
{{ if .Content }}
{{ `<content type="html"><![CDATA[` | safeHTML }}
{{ .Content }}
{{ $c := .Content }}
{{ $alink := .Permalink }}
{{ range .Resources.ByType "image" }}
{{ if and (not (in $c .Name)) (not (in .Name "banner")) }}
<a href="{{ $alink }}" class="article_image no_underline"> <img loading="lazy" src="{{ .Permalink }}" alt="{{ .Name }}" width=780 height="520" /><br> {{ .Name }} </a>
{{ end }}
{{ end }}
]]></content>
{{ end }}
</entry>{{ end }}
</feed>