kekskurse.de/themes/nostylepleaseL/layouts/partials/post_list.html

40 lines
1.1 KiB
HTML
Raw Normal View History

2024-07-28 22:39:10 +00:00
{{- $posts := "" -}}
{{- if .section -}}
{{- $posts = (where site.RegularPages "Section" .section) -}}
{{- else -}}
{{- if (eq .context.Kind "taxonomy") -}}
{{- $posts = .context.Pages -}}
{{- else -}}
{{- if (eq .context.Kind "term") -}}
{{- $posts = .context.Data.Pages -}}
{{- else -}}
{{- $posts = site.RegularPages }}
{{- end -}}
{{- end -}}
{{- end -}}
{{- $limit_exceeded:= "" -}}
{{- if (and .limit (gt (len $posts) .limit)) -}}
{{- $limit_exceeded = true -}}
{{- else -}}
{{- $limit_exceeded = false -}}
{{ end }}
{{- if (gt (len $posts) 0) }}
{{- if .limit }}
{{ $posts = (first .limit $posts ) }}
{{ end }}
<ul>
{{- range $post := $posts -}}
<li>
<span>{{- ($post.Date | time.Format site.Params.theme_config.date_format) }}</span>
<a href="{{ $post.Permalink | relURL }}">{{ $post.Title }}</a>
</li>
{{ end }}
{{- if and .show_more $limit_exceeded }}
<li><a href="{{ .show_more_url | relURL }}">{{ .show_more_text | default "Show more..." }}</a></li>
{{ end }}
</ul>
{{ end }}