bunteshaus.de/themes/buha/layouts/partials/layout/article_list.html
2022-05-09 23:17:23 +02:00

82 lines
3.3 KiB
HTML

{{ if and .amount .pages }}
{{ $amount := .amount }}
{{ $type := .type }}
{{ $pages := .pages.ByLastmod.Reverse }}
{{ $p := .pages.ByLastmod.Reverse }}
{{- $paginator := .context.Paginate $pages -}}
{{ if .paginate }}
{{ $p = $paginator.Pages }}
{{ end }}
{{ if eq $paginator.PageNumber 1 }}
{{ if .content }}
{{ partial "snippets/content" (dict "content" .content) }}
{{ end }}
{{ end }}
{{- if gt (len $pages) 0 -}}
<section class="list">
{{ if .title }}<h2>{{ .title }}</h2>{{ end }}
{{- $home := .context.Kind }}
{{- range first $amount $p -}}
<article class="article_list_section">
<a href="{{- .Permalink -}}">
<div class="articletitle">
{{ $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 }}
</div>
</a>
<a href="{{- .Permalink -}}" class="no_underline">
<div class="articlecontent">
{{ $px := string "400" }}
{{ $fill := string (printf "1280x%s smart" $px) }}
{{ $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}}
{{ $thumb = $image.Fill $fill }}
{{ 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 }}
</div>
</a>
</article>
{{ end }}
{{ if .paginate }}
{{ partial "snippets/paginator" (dict "paginator" $paginator) }}
{{ end }}
</section>
{{ end }}
{{ end }}