2022-05-06 11:49:30 +02:00
|
|
|
{{ $title := .Title }}
|
|
|
|
{{ $title = singularize $title }}
|
|
|
|
{{ $title = i18n $title }}
|
|
|
|
{{ if not $title }}
|
|
|
|
{{ $title = .Title }}
|
|
|
|
{{ end }}
|
2022-06-12 19:27:57 +02:00
|
|
|
{{ $good_w := "1920"}}
|
|
|
|
{{ $good_h := "550"}}
|
2022-05-06 13:29:00 +02:00
|
|
|
{{ $what := "none" }}
|
|
|
|
{{ $img := "none" }}
|
|
|
|
{{ if eq .Kind "home" }}
|
|
|
|
{{ $what = "home" }}
|
2022-05-06 14:01:05 +02:00
|
|
|
{{ else }}
|
|
|
|
{{ with .File }}
|
|
|
|
{{ $what = .File.ContentBaseName }}
|
|
|
|
{{ end }}
|
2022-05-06 13:29:00 +02:00
|
|
|
{{ end }}
|
2022-06-12 21:14:14 +02:00
|
|
|
{{ $title_class := safeCSS "title" }}
|
2022-06-13 04:08:02 +02:00
|
|
|
{{ $css := safeCSS "b" }}
|
2022-06-12 21:14:14 +02:00
|
|
|
{{ if .IsHome }}
|
2022-06-13 04:08:02 +02:00
|
|
|
{{ $css = safeCSS "b_index" }}
|
2022-06-12 21:14:14 +02:00
|
|
|
{{ $title_class = safeCSS "title_index" }}
|
|
|
|
{{ end }}
|
2022-06-13 04:08:02 +02:00
|
|
|
{{ $banner := string (printf "/images/banner/%s*" $what) }}
|
2022-05-06 13:29:00 +02:00
|
|
|
{{ if resources.GetMatch $banner }}
|
2022-06-12 23:48:26 +02:00
|
|
|
{{ $img = resources.GetMatch $banner }}
|
2022-05-06 13:29:00 +02:00
|
|
|
{{ end }}
|
2022-06-13 04:08:02 +02:00
|
|
|
{{ $single := false }}
|
|
|
|
{{ if and (in .File "news/") (not (in .File "_index"))}}
|
|
|
|
{{ $single = true }}
|
|
|
|
{{ end }}
|
|
|
|
{{ if and (ne $img "none") (ne .Params.banner false) }}
|
|
|
|
<div style="background-image: url({{- $img.Permalink -}})" class="banner {{ $css }}">
|
2022-06-12 21:33:34 +02:00
|
|
|
{{ if not .IsHome }}<h1 class="{{ $title_class }}">{{ $title }}</h1> {{ end }}
|
2022-06-12 17:24:42 +02:00
|
|
|
{{ if eq hugo.Environment "development" }}
|
2022-06-14 23:01:19 +02:00
|
|
|
<div style="color: black;">
|
2022-06-12 19:27:57 +02:00
|
|
|
{{ $w := (resources.GetMatch $banner).Width }}
|
|
|
|
{{ $h := (resources.GetMatch $banner).Height }}
|
|
|
|
{{ if lt (int $w) $good_w }}
|
|
|
|
{{ if eq hugo.Environment "development" }}
|
|
|
|
Width: {{ $w }}px: too small, better {{ $good_w -}}px in width<br>
|
|
|
|
{{ end }}
|
|
|
|
{{ else if gt (int $w) $good_w }}
|
|
|
|
{{ if eq hugo.Environment "development" }}
|
|
|
|
Width: {{ $w }}px: too big, better {{ $good_w -}}px in width<br>
|
|
|
|
{{ end }}
|
|
|
|
{{ end }}
|
|
|
|
{{ if lt (int $h) $good_h }}
|
|
|
|
{{ if eq hugo.Environment "development" }}
|
|
|
|
Height: {{ $h }}px: too small, better {{ $good_h -}}px in height<br>
|
|
|
|
{{ end }}
|
|
|
|
{{ else if gt (int $h) $good_h }}
|
|
|
|
{{ if eq hugo.Environment "development" }}
|
|
|
|
Height: {{ $h }}px: too big, better {{ $good_h -}}px in height<br>
|
|
|
|
{{ end }}
|
|
|
|
{{ end }}
|
2022-06-07 20:15:31 +02:00
|
|
|
</div>
|
|
|
|
{{ end }}
|
|
|
|
</div>
|
2022-05-09 21:37:34 +02:00
|
|
|
{{ else if and (.Resources.Match "banner*") (ne .Params.banner false) }}
|
2022-06-12 23:48:26 +02:00
|
|
|
{{ $img = .Resources.GetMatch "banner*" }}
|
2022-06-13 04:08:02 +02:00
|
|
|
<div style="background-image:url({{- $img.Permalink -}})" class="banner {{ $css }}">
|
2022-06-12 21:33:34 +02:00
|
|
|
{{ if not .IsHome }}<h1 class="{{ $title_class }}">{{ $title }}</h1> {{ end }}
|
2022-06-12 17:24:42 +02:00
|
|
|
{{ if eq hugo.Environment "development" }}
|
2022-06-14 23:01:19 +02:00
|
|
|
<div style="color: black;">
|
2022-06-12 19:27:57 +02:00
|
|
|
{{ $w := (index (.Resources.Match "banner*") 0).Width }}
|
|
|
|
{{ $h := (index (.Resources.Match "banner*") 0).Height }}
|
|
|
|
{{ if lt (int $w) $good_w }}
|
|
|
|
{{ if eq hugo.Environment "development" }}
|
|
|
|
Width: {{ $w }}px: too small, better {{ $good_w -}}px in width<br>
|
|
|
|
{{ end }}
|
|
|
|
{{ else if gt (int $w) $good_w }}
|
|
|
|
{{ if eq hugo.Environment "development" }}
|
|
|
|
Width: {{ $w }}px: too big, better {{ $good_w -}}px in width<br>
|
|
|
|
{{ end }}
|
|
|
|
{{ end }}
|
|
|
|
{{ if lt (int $h) $good_h }}
|
|
|
|
{{ if eq hugo.Environment "development" }}
|
|
|
|
Height: {{ $h }}px: too small, better {{ $good_h -}}px in height<br>
|
|
|
|
{{ end }}
|
|
|
|
{{ else if gt (int $h) $good_h }}
|
|
|
|
{{ if eq hugo.Environment "development" }}
|
|
|
|
Height: {{ $h }}px: too big, better {{ $good_h -}}px in height<br>
|
|
|
|
{{ end }}
|
|
|
|
{{ end }}
|
2022-06-12 17:24:42 +02:00
|
|
|
</div>
|
|
|
|
{{ end }}
|
2022-06-07 20:15:31 +02:00
|
|
|
</div>
|
2022-06-12 23:48:26 +02:00
|
|
|
{{ else if and (.Resources.ByType "image") (ne .Params.banner false) (not true) }}
|
|
|
|
{{ $img = index (.Resources.ByType "image") 0 }}
|
2022-06-13 04:08:02 +02:00
|
|
|
<div style="background-image: url({{- $img.Permalink -}})" class="banner {{ $css }}">
|
2022-06-12 21:33:34 +02:00
|
|
|
{{ if not .IsHome }}<h1 class="{{ $title_class }}">{{ $title }}</h1> {{ end }}
|
2022-06-12 17:24:42 +02:00
|
|
|
{{ if eq hugo.Environment "development" }}
|
2022-06-14 23:01:19 +02:00
|
|
|
<div style="color: black;">
|
2022-06-12 19:27:57 +02:00
|
|
|
{{ $w := (index (.Resources.ByType "image") 0).Width }}
|
|
|
|
{{ $h := (index (.Resources.ByType "image") 0).Height }}
|
|
|
|
{{ if lt (int $w) $good_w }}
|
|
|
|
{{ if eq hugo.Environment "development" }}
|
|
|
|
Width: {{ $w }}px: too small, better {{ $good_w -}}px in width<br>
|
|
|
|
{{ end }}
|
|
|
|
{{ else if gt (int $w) $good_w }}
|
|
|
|
{{ if eq hugo.Environment "development" }}
|
|
|
|
Width: {{ $w }}px: too big, better {{ $good_w -}}px in width<br>
|
|
|
|
{{ end }}
|
|
|
|
{{ end }}
|
|
|
|
{{ if lt (int $h) $good_h }}
|
|
|
|
{{ if eq hugo.Environment "development" }}
|
|
|
|
Height: {{ $h }}px: too small, better {{ $good_h -}}px in height<br>
|
|
|
|
{{ end }}
|
|
|
|
{{ else if gt (int $h) $good_h }}
|
|
|
|
{{ if eq hugo.Environment "development" }}
|
|
|
|
Height: {{ $h }}px: too big, better {{ $good_h -}}px in height<br>
|
|
|
|
{{ end }}
|
|
|
|
{{ end }}
|
2022-06-12 17:24:42 +02:00
|
|
|
</div>
|
|
|
|
{{ end }}
|
2022-06-07 20:15:31 +02:00
|
|
|
</div>
|
2022-05-06 13:29:00 +02:00
|
|
|
{{ else }}
|
2022-06-14 23:01:19 +02:00
|
|
|
<div class="banner non_banner_height">
|
2022-06-12 21:33:34 +02:00
|
|
|
{{ if not .IsHome }}<h1 class="{{ $title_class }}">{{ $title }}</h1> {{ end }}
|
2022-06-12 17:24:42 +02:00
|
|
|
{{ if eq hugo.Environment "development" }}
|
2022-06-13 04:08:02 +02:00
|
|
|
{{ $str1 := printf "assets/images/banner/%s* missing.." $what }}
|
|
|
|
{{ $str2 := printf "content//banner* missing.." }}
|
|
|
|
{{ with .File }}
|
|
|
|
{{ $str2 = printf "content/%s/banner* missing.." .Dir }}
|
|
|
|
{{ end }}
|
2022-06-12 19:27:57 +02:00
|
|
|
<p>
|
2022-06-13 04:08:02 +02:00
|
|
|
{{ if eq .Params.banner false }}
|
|
|
|
banner is off
|
|
|
|
{{ else }}
|
|
|
|
{{ if eq $single true }}
|
|
|
|
{{ $str2 }}
|
|
|
|
{{ else if eq $single false }}
|
|
|
|
{{ $str1 }}
|
|
|
|
{{ end }}
|
|
|
|
{{ end }}
|
2022-06-12 19:27:57 +02:00
|
|
|
</p>
|
2022-06-12 17:24:42 +02:00
|
|
|
{{ end }}
|
|
|
|
</div>
|
2022-05-06 11:49:30 +02:00
|
|
|
{{ end }}
|