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

103 lines
5.0 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 -}}
<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%"/>-->
<div style="background: url({{ $image.Permalink }}); background-attachment: fixed; background-size: cover; height: 50vh; box-shadow: inset 0px 11px 8px -10px #222, inset 0px -11px 8px -10px #222; border: 4px solid var(--background); margin-bottom: 4rem;">
<div style="display: flex; flex-direction: column;">
<div style="background: var(--background-alt); margin-top: 5rem; padding-left: 2rem; padding-right: 2rem; padding-bottom: 1rem;" 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>
{{- if .Content -}}
<div style="background: var(--background-alt); padding-left: 2rem; padding-right: 2rem; padding-bottom: 1rem;" class="article_content"><p>{{- .Summary -}}<p></div>
{{ end }}
</div>
</div>
{{ 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 }}