bunteshaus.de/themes/buha/layouts/partials/layout/article_list.html
2022-05-10 04:16:08 +02:00

90 lines
3.8 KiB
HTML

{{ if and .amount .pages }}
{{ $amount := .amount }}
{{ $type := .type }}
{{ $title := .title }}
{{ $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 -}}
{{ $px := string "400" }}
{{ $fill := string (printf "1280x%s smart" $px) }}
{{ $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) }}
{{ $banner = (index $banner 0) }}
{{ $thumb = $banner.Fill $fill }}
{{ $bg_pic := "" }}
<article class="article_list_section">
<a href="{{- .Permalink -}}" class="no_underline">
<div class="articlecontent">
{{ $metas := dict "when" .Params.when "price" .Params.price }}
{{ $thumb := "" }}
{{ $banner := slice }}
{{ if (.Resources.GetMatch "banner*") }}
{{ if $banner = slice (.Resources.GetMatch "banner*") }}
{{ $banner = (index $banner 0) }}
{{ $thumb = $banner}}
{{ $thumb = $banner.Fill $fill }}
{{ $bg_pic = safeCSS (printf "background: url(%s)" $thumb.Permalink) }}
{{ end }}
{{ end }}
<div style="background-color: var(--background-alt); {{ $bg_pic }}; background-position: top; background-repeat: no-repeat; {{ safeCSS (printf "min-height: %spx" (string $px)) }}; box-shadow: inset 0px 11px 8px -10px #222, inset 0px -11px 8px -10px #222; margin-bottom: 4rem;">
<div style="display: flex; flex-direction: column;">
<div style="margin-top: 5rem;" class="article_content article_content 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 }}
{{ partial "snippets/article_metadata" $metas }}
<div style="display: flex;">
{{- if .Content -}}
<div>
{{- .Summary -}}
</div>
{{ end }}
</div>
</div>
</div>
</div>
</div>
</a>
</article>
{{ end }}
{{ if .paginate }}
{{ partial "snippets/paginator" (dict "paginator" $paginator) }}
{{ end }}
</section>
{{ end }}
{{ end }}