bunteshaus.de/themes/buha/layouts/partials/layout/article_list.html

82 lines
3.3 KiB
HTML
Raw Normal View History

2022-05-06 11:49:30 +02:00
{{ if and .amount .pages }}
2022-04-09 21:34:04 +02:00
{{ $amount := .amount }}
2022-05-09 21:37:34 +02:00
{{ $type := .type }}
2022-04-10 11:18:04 +02:00
{{ $pages := .pages.ByLastmod.Reverse }}
2022-05-06 13:29:00 +02:00
{{ $p := .pages.ByLastmod.Reverse }}
2022-04-10 11:18:04 +02:00
{{- $paginator := .context.Paginate $pages -}}
2022-05-06 13:29:00 +02:00
{{ if .paginate }}
2022-05-06 14:01:05 +02:00
{{ $p = $paginator.Pages }}
2022-05-06 13:29:00 +02:00
{{ end }}
2022-04-10 11:18:04 +02:00
{{ if eq $paginator.PageNumber 1 }}
{{ if .content }}
{{ partial "snippets/content" (dict "content" .content) }}
{{ end }}
{{ end }}
2022-04-09 21:34:04 +02:00
{{- if gt (len $pages) 0 -}}
2022-05-09 21:37:34 +02:00
<section class="list">
2022-04-11 15:45:49 +02:00
{{ if .title }}<h2>{{ .title }}</h2>{{ end }}
2022-05-06 14:01:05 +02:00
{{- $home := .context.Kind }}
2022-05-06 13:29:00 +02:00
{{- range first $amount $p -}}
2022-05-09 21:37:34 +02:00
<article class="article_list_section">
<a href="{{- .Permalink -}}">
2022-04-12 08:26:18 +02:00
<div class="articletitle">
2022-05-09 21:37:34 +02:00
{{ $cat := "" }}
{{ if .Page.Params.events }}
{{ $cat = index .Page.Params.events 0 }}
{{ $cat = printf "%s: " $cat }}
{{ end }}
{{ if eq $type "index" }}
<h3>{{ $cat -}}{{- .Title -}}</h3>
{{ else }}
<h2>{{ $cat -}}{{- .Title -}}</h2>
{{ end }}
2022-04-09 21:34:04 +02:00
</div>
</a>
2022-04-12 08:26:18 +02:00
<a href="{{- .Permalink -}}" class="no_underline">
<div class="articlecontent">
2022-05-09 23:17:23 +02:00
{{ $px := string "400" }}
{{ $fill := string (printf "1280x%s smart" $px) }}
2022-05-09 21:37:34 +02:00
{{ $metas := dict "when" .Params.when "price" .Params.price }}
{{ $banner := slice }}
{{ $image := slice }}
{{ $thumb := "" }}
{{ if .Resources.GetMatch "banner*" }}
{{ $banner = slice (.Resources.GetMatch "banner*") }}
{{ end }}
{{ if .Resources.ByType "image" }}
{{ $image = .Resources.ByType "image" }}
{{ end }}
{{ $image = (index (complement $banner $image) 0) }}
{{ if $banner }}
{{ $image = (index $banner 0) }}
{{ end }}
{{ $image = .Resources.GetMatch (string $image) }}
{{ if ne $image nil }}
{{ $thumb = $image}}
2022-05-09 23:17:23 +02:00
{{ $thumb = $image.Fill $fill }}
2022-05-09 21:37:34 +02:00
{{ end }}
{{ partial "snippets/article_metadata" $metas }}
{{ if $thumb }}
<img src="{{ $thumb.Permalink }}" width="100%"/>
{{ end }}
{{- if .Content -}}
<div class="article_content"><p>{{- .Summary -}}<p></div>
{{ end }}
2022-04-09 21:34:04 +02:00
</div>
</a>
</article>
{{ end }}
2022-04-10 11:18:04 +02:00
{{ if .paginate }}
{{ partial "snippets/paginator" (dict "paginator" $paginator) }}
{{ end }}
2022-05-06 13:29:00 +02:00
</section>
2022-04-09 21:34:04 +02:00
{{ end }}
{{ end }}