small fixes

This commit is contained in:
teldra 2022-06-17 10:20:00 +02:00
parent 18fac67a90
commit 5fc91a1191
1 changed files with 6 additions and 4 deletions

View File

@ -38,18 +38,19 @@
{{ with .File }} {{ with .File }}
{{ $slug = anchorize .ContentBaseName }} {{ $slug = anchorize .ContentBaseName }}
{{ end }} {{ end }}
{{ if and ($img) (ne .Params.banner false) }} {{ if or (and $img (ne .Params.banner false)) (.Resources.ByType "image") }}1
{{ if .Resources.Match "banner*" }} {{ if .Resources.Match "banner*" }}
{{ $img = .Resources.GetMatch "banner*" }} {{ $img = .Resources.GetMatch "banner*" }}
{{ end }} {{ end }}
{{ if .Resources.ByType "image" }} {{ if .Resources.ByType "image" }}
{{ $img = index (.Resources.ByType "image") 0 }} {{ $img = index (.Resources.ByType "image") 0 }}
{{ end }} {{ end }}
{{ if $img }}
<div style="background-image: url({{- $img.Permalink -}})" class="banner {{ $css }}"> <div style="background-image: url({{- $img.Permalink -}})" class="banner {{ $css }}">
{{ if eq hugo.Environment "development" }} {{ if eq hugo.Environment "development" }}
<div class="dev right"> <div class="dev right">
{{ $w := (resources.GetMatch $banner).Width }} {{ $w := $img.Width }}
{{ $h := (resources.GetMatch $banner).Height }} {{ $h := $img.Height }}
{{ if lt (int $w) $good_w }} {{ if lt (int $w) $good_w }}
{{ $b = false }} {{ $b = false }}
{{ if eq hugo.Environment "development" }} {{ if eq hugo.Environment "development" }}
@ -81,7 +82,8 @@
{{ end }} {{ end }}
{{ if not .IsHome }}<h1 class="{{ $title_class }}">{{ $title }}</h1> {{ end }} {{ if not .IsHome }}<h1 class="{{ $title_class }}">{{ $title }}</h1> {{ end }}
</div> </div>
{{ else }} {{ end }}
{{ else }}2
<div class="banner b altbg"> <div class="banner b altbg">
{{ if eq hugo.Environment "development" }} {{ if eq hugo.Environment "development" }}
{{ if eq .Params.banner false }} {{ if eq .Params.banner false }}