forked from Bunteshaus/bunteshaus.de
88 lines
2.7 KiB
HTML
88 lines
2.7 KiB
HTML
{{ $title := .title }}
|
|
|
|
{{ $p := .pages }}
|
|
{{ if and (.limit) (not .paginate) }}
|
|
{{ $p = first .limit .pages }}
|
|
{{ end }}
|
|
|
|
{{ $paginator := .pages }}
|
|
{{ if .paginate }}
|
|
{{ $paginator = .context.Paginate $p }}
|
|
{{ $p = $paginator.Pages }}
|
|
{{ end }}
|
|
|
|
|
|
|
|
{{ if $p }}
|
|
<div class="gen_list">
|
|
{{ if $title }}<h2>{{ $title }}</h2>{{ end }}
|
|
{{ range $p }}
|
|
<div class="list_item">
|
|
{{ $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 }}
|
|
{{ .Title }}
|
|
{{ if $title }}</h3>{{ else }}</h2>{{ end }}
|
|
{{ with .Resources.GetMatch $banner }}
|
|
{{ if eq hugo.Environment "development" }}
|
|
{{ $good_ratio := "1.7777777777777777"}}
|
|
{{ $ratio := div (float .Width) (float .Height) }}
|
|
{{ if lt $ratio $good_ratio }}
|
|
Ratio: {{ $ratio }}: not a good ratio, better around {{ $good_ratio }} (lower the hight in relation to the width)<br>
|
|
{{ else if gt $ratio $good_ratio }}
|
|
Ratio: {{ $ratio }}: not a good ratio, better around {{ $good_ratio }}(higher)<br>
|
|
{{ end }}
|
|
{{ if lt (int .Width) "1920" }}
|
|
Width: {{ .Width }}px: too small, better 1920px in width<br>
|
|
{{ else if gt (int .Width) "1920" }}
|
|
Width: {{ .Width }}px: too big, better 1920px in width<br>
|
|
{{ end }}
|
|
{{ if lt (int .Height) "1080" }}
|
|
Height: {{ .Height }}px: too small, better 1080px in height<br>
|
|
{{ else if gt (int .Height) "1080" }}
|
|
Height: {{ .Height }}px: too big, better 1080px in height<br>
|
|
{{ end }}
|
|
{{ end }}
|
|
<div class="img" style="background-image: url({{ .Permalink }})">
|
|
</div>
|
|
{{ end }}
|
|
<div class="text">
|
|
{{ if .Description }}
|
|
<p>{{ .Description }}</p>
|
|
{{ else if .Summary }}
|
|
{{ if hasPrefix .Summary "<p>" }}
|
|
{{ .Summary }}
|
|
{{ else }}
|
|
<p>{{ .Summary }} </p>
|
|
{{ end }}
|
|
{{ else if .Content }}
|
|
<p>{{ .Content }}</p>
|
|
{{ else if $image }}
|
|
{{ $i := (.Resources.GetMatch $image).Permalink }}
|
|
<div class="img-only" style="background-image: url({{ $i }})">
|
|
</div>
|
|
{{ end }}
|
|
</div>
|
|
</section>
|
|
</a>
|
|
</div>
|
|
{{ end }}
|
|
|
|
{{ if .paginate }}
|
|
{{ partial "snippets/paginator" (dict "paginator" $paginator) }}
|
|
{{ end }}
|
|
</div>
|
|
{{ end }}
|