bunteshaus.de/themes/buha/layouts/partials/layout/gen_list.html
2022-06-15 17:15:05 +02:00

136 lines
4.0 KiB
HTML

{{ $title := .title }}
{{ $link := .link }}
{{ $p := .pages }}
{{ if and (.limit) (not .paginate) }}
{{ $p = first .limit .pages }}
{{ end }}
{{ $act_section := .context.Section }}
{{ $paginator := .pages }}
{{ if .paginate }}
{{ $paginator = .context.Paginate $p }}
{{ $p = $paginator.Pages }}
{{ end }}
{{ if $p }}
<div class="gen_list">
{{ if $title }}
<h2>
{{ if $link }}
<a href="{{ $link | relLangURL }}">
{{ end }}
{{ $title }}
{{ if $link }}
</a>
{{ end }}
</h2>
{{ end }}
{{ range $p }}
<div class="list_item">
{{ $metas := dict "when" .Params.when "price" .Params.price }}
{{ $banner := slice }}
{{ $image := slice }}
{{ $images := slice }}
{{ if .Resources.GetMatch "banner*" }}
{{ $banner = slice (.Resources.GetMatch "banner*") }}
{{ end }}
{{ if .Resources.ByType "image" }}
{{ $image = .Resources.ByType "image" }}
{{ end }}
{{ $images = complement $banner $image }}
{{ $image = (index (complement $banner $image) 0) }}
{{ $banner = (index $banner 0) }}
<a href="{{ .Permalink }}">
<section>
{{ if $title }}<h3>{{ else }}<h2>{{ end }}
{{ if ne $act_section "about" }}
{{ if .Params.events }}
{{ index .Params.events 0 }}:
{{ else if .Params.recurrent }}
{{ if i18n "recurrent"}}
{{ i18n "recurrent"}}:
{{ else }}
{{ "Recurrent"}}:
{{ end }}
{{ else if .Params.categories }}
{{ if in .Params.categories "Buha" }}
In eigener Sache:
{{ end }}
{{ end }}
{{ end }}
{{ .Title }}
{{ if $title }}</h3>{{ else }}</h2>{{ end }}
{{ with .Resources.GetMatch $banner }}
{{ $good_w := "1920"}}
{{ $good_h := "550"}}
{{ $b := true }}
{{ if or (lt (int .Width) $good_w) (gt (int .Width) $good_w) (lt (int .Height) $good_h) (gt (int .Height) $good_h) }}
<div class="dev left" style="margin: 1rem;">
{{ if lt (int .Width) $good_w }}
{{ $b = false }}
{{ if eq hugo.Environment "development" }}
Width: {{ .Width }}px: too small, must be {{ $good_w -}}px in width<br>
{{ end }}
{{ else if gt (int .Width) $good_w }}
{{ $b = false }}
{{ if eq hugo.Environment "development" }}
Width: {{ .Width }}px: too big, must be {{ $good_w -}}px in width<br>
{{ end }}
{{ end }}
{{ if lt (int .Height) $good_h }}
{{ $b = false }}
{{ if eq hugo.Environment "development" }}
Height: {{ .Height }}px: too small, must be {{ $good_h -}}px in height<br>
{{ end }}
{{ else if gt (int .Height) $good_h }}
{{ $b = false }}
{{ if eq hugo.Environment "development" }}
Height: {{ .Height }}px: too big, must be {{ $good_h -}}px in height<br>
{{ end }}
{{ end }}
</div>
{{ end }}
<!--<div class="img" style="background-image: url({{ .Permalink }})">
</div>-->
{{ if eq $b true }}
<img src="{{ .Permalink }}" alt="Banner Image." />
{{ end }}
{{ end }}
{{ partial "snippets/article_metadata" $metas }}
<div class="text">
{{ if .Description }}
<p>{{ .Description }}</p>
{{ else if .Content }}
{{ $summary := "" }}
{{ if in .RawContent "<!--more-->" }}
{{ $tmp := split .RawContent "<!--more-->" }}
{{ index $tmp 0 | markdownify }}
{{ else }}
{{ if hasPrefix .Summary "<p>" }}
{{ .Summary }}
{{ else }}
<p>{{ .Summary }} </p>
{{ end }}
{{ end }}
{{ else if $image }}
{{ $i := (.Resources.GetMatch $image).Permalink }}
<img src="{{ $i }}" />
{{ end }}
</div>
{{ if .Truncated }}
<div class="readmore">
{{ if i18n "readmore" }}{{ i18n "readmore" }}{{ else }}{{ "read more" }}{{ end }}..
</div>
{{ end }}
</section>
</a>
</div>
{{ end }}
{{ if .paginate }}
{{ partial "snippets/paginator" (dict "paginator" $paginator) }}
{{ end }}
</div>
{{ end }}