2022-06-08 00:38:13 +02:00
|
|
|
{{ $title := .title }}
|
2022-06-07 20:15:31 +02:00
|
|
|
|
2022-06-07 13:36:28 +02:00
|
|
|
{{ $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 or .content (and (.paginate) (.content) (eq $paginator.PageNumber 1)) }}
|
|
|
|
{{ partial "snippets/content" (dict "content" .context.Content) }}
|
|
|
|
{{ end }}
|
|
|
|
|
|
|
|
{{ if $p }}
|
|
|
|
<div class="gen_list">
|
2022-06-08 00:38:13 +02:00
|
|
|
{{ if $title }}<h2>{{ $title }}</h2>{{ end }}
|
|
|
|
{{ range $p }}
|
|
|
|
<div class="article_list">
|
|
|
|
{{ $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" }}
|
|
|
|
{{ $ratio := div (float .Width) (float .Height) }}
|
|
|
|
{{ if lt $ratio "2.4" }}
|
|
|
|
Ratio: {{ slicestr $ratio 0 4 }}: not a good ratio, better around 2.6 (lower the hight in relation to the width)<br>
|
|
|
|
{{ else if gt $ratio "2.7" }}
|
|
|
|
Ratio: {{ slicestr $ratio 0 4 }}: not a good ratio, better around 2.6 (higher)<br>
|
|
|
|
{{ end }}
|
|
|
|
{{ if lt (int .Width) "1200" }}
|
|
|
|
Width: {{ .Width }}px: too small, better 1200px in width<br>
|
|
|
|
{{ else if gt (int .Width) "1200" }}
|
|
|
|
Width: {{ .Width }}px: too big, better 1200px in width<br>
|
|
|
|
{{ end }}
|
|
|
|
{{ if lt (int .Height) "460" }}
|
|
|
|
Height: {{ .Height }}px: too small, better 800px in height<br>
|
|
|
|
{{ else if gt (int .Height) "460" }}
|
|
|
|
Height: {{ .Height }}px: too big, better 460px in height<br>
|
|
|
|
{{ end }}
|
2022-06-07 20:15:31 +02:00
|
|
|
{{ end }}
|
2022-06-08 00:38:13 +02:00
|
|
|
<div class="img" style="background-image: url({{ .Permalink }})">
|
|
|
|
</div>
|
|
|
|
{{ end }}
|
2022-06-08 04:42:32 +02:00
|
|
|
<div class="text">
|
2022-06-08 00:38:13 +02:00
|
|
|
{{ if .Description }}
|
2022-06-08 04:56:35 +02:00
|
|
|
<p>{{ .Description }}</p>
|
2022-06-08 00:38:13 +02:00
|
|
|
{{ else if .Summary }}
|
2022-06-08 04:56:35 +02:00
|
|
|
{{ if hasPrefix .Summary "<p>" }}
|
|
|
|
{{ .Summary }}
|
|
|
|
{{ else }}
|
|
|
|
<p>{{ .Summary }} </p>
|
|
|
|
{{ end }}
|
2022-06-08 00:38:13 +02:00
|
|
|
{{ else if .Content }}
|
2022-06-08 04:56:35 +02:00
|
|
|
<p>{{ .Content }}</p>
|
2022-06-08 00:38:13 +02:00
|
|
|
{{ else if $image }}
|
|
|
|
{{ $i := (.Resources.GetMatch $image).Permalink }}
|
|
|
|
<div class="img-only" style="background-image: url({{ $i }})">
|
|
|
|
</div>
|
2022-06-07 20:15:31 +02:00
|
|
|
{{ end }}
|
2022-06-08 04:42:32 +02:00
|
|
|
</div>
|
2022-06-08 00:38:13 +02:00
|
|
|
</section>
|
|
|
|
</a>
|
|
|
|
</div>
|
|
|
|
{{ end }}
|
2022-06-07 13:36:28 +02:00
|
|
|
|
2022-06-08 00:38:13 +02:00
|
|
|
{{ if .paginate }}
|
|
|
|
{{ partial "snippets/paginator" (dict "paginator" $paginator) }}
|
|
|
|
{{ end }}
|
2022-06-07 13:36:28 +02:00
|
|
|
</div>
|
|
|
|
{{ end }}
|