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"}}
|
2022-06-15 11:48:59 +02:00
|
|
|
{{ $good_h := "850"}}
|
2022-05-06 13:29:00 +02:00
|
|
|
{{ $what := "none" }}
|
2022-06-15 13:46:50 +02:00
|
|
|
{{ $missing := "" }}
|
|
|
|
{{ $banner := "" }}
|
2022-05-06 13:29:00 +02:00
|
|
|
{{ $img := "none" }}
|
|
|
|
{{ if eq .Kind "home" }}
|
|
|
|
{{ $what = "home" }}
|
2022-06-15 13:46:50 +02:00
|
|
|
{{ $banner = "home" }}
|
|
|
|
{{ else if eq .Kind "page" }}
|
2022-05-06 14:01:05 +02:00
|
|
|
{{ with .File }}
|
|
|
|
{{ $what = .File.ContentBaseName }}
|
2022-06-15 13:46:50 +02:00
|
|
|
{{ $banner = $what }}
|
2022-05-06 14:01:05 +02:00
|
|
|
{{ end }}
|
2022-06-15 13:46:50 +02:00
|
|
|
{{ else if or (eq .Kind "term") (eq .Kind "taxonomy") }}
|
|
|
|
{{ if (eq .Kind "taxonomy") }}
|
|
|
|
{{ $what = .Data.Singular | lower }}
|
|
|
|
{{ else }}
|
|
|
|
{{ $what = .Name | lower }}
|
|
|
|
{{ end }}
|
|
|
|
{{ $banner = string (printf "/images/banner/%s/%s*" .Kind $what) }}
|
2022-05-06 13:29:00 +02:00
|
|
|
{{ end }}
|
2022-06-15 13:46:50 +02:00
|
|
|
{{ $missing := $banner }}
|
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-15 13:46:50 +02:00
|
|
|
|
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-15 13:46:50 +02:00
|
|
|
<div style="color: red;">
|
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" }}
|
2022-06-15 13:46:50 +02:00
|
|
|
Width: {{ $w }}px: too small, must be {{ $good_w -}}px in width<br>
|
2022-06-12 19:27:57 +02:00
|
|
|
{{ end }}
|
|
|
|
{{ else if gt (int $w) $good_w }}
|
|
|
|
{{ if eq hugo.Environment "development" }}
|
2022-06-15 13:46:50 +02:00
|
|
|
Width: {{ $w }}px: too big, must be {{ $good_w -}}px in width<br>
|
2022-06-12 19:27:57 +02:00
|
|
|
{{ end }}
|
|
|
|
{{ end }}
|
|
|
|
{{ if lt (int $h) $good_h }}
|
|
|
|
{{ if eq hugo.Environment "development" }}
|
2022-06-15 13:46:50 +02:00
|
|
|
Height: {{ $h }}px: too small, must be {{ $good_h -}}px in height<br>
|
2022-06-12 19:27:57 +02:00
|
|
|
{{ end }}
|
|
|
|
{{ else if gt (int $h) $good_h }}
|
|
|
|
{{ if eq hugo.Environment "development" }}
|
2022-06-15 13:46:50 +02:00
|
|
|
Height: {{ $h }}px: too big, must be {{ $good_h -}}px in height<br>
|
2022-06-12 19:27:57 +02:00
|
|
|
{{ 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-15 13:46:50 +02:00
|
|
|
<div style="color: red;">
|
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" }}
|
2022-06-15 13:46:50 +02:00
|
|
|
Width: {{ $w }}px: too small, must be {{ $good_w -}}px in width<br>
|
2022-06-12 19:27:57 +02:00
|
|
|
{{ end }}
|
|
|
|
{{ else if gt (int $w) $good_w }}
|
|
|
|
{{ if eq hugo.Environment "development" }}
|
2022-06-15 13:46:50 +02:00
|
|
|
Width: {{ $w }}px: too big, must be {{ $good_w -}}px in width<br>
|
2022-06-12 19:27:57 +02:00
|
|
|
{{ end }}
|
|
|
|
{{ end }}
|
|
|
|
{{ if lt (int $h) $good_h }}
|
|
|
|
{{ if eq hugo.Environment "development" }}
|
2022-06-15 13:46:50 +02:00
|
|
|
Height: {{ $h }}px: too small, must be {{ $good_h -}}px in height<br>
|
2022-06-12 19:27:57 +02:00
|
|
|
{{ end }}
|
|
|
|
{{ else if gt (int $h) $good_h }}
|
|
|
|
{{ if eq hugo.Environment "development" }}
|
2022-06-15 13:46:50 +02:00
|
|
|
Height: {{ $h }}px: too big, must be {{ $good_h -}}px in height<br>
|
2022-06-12 19:27:57 +02:00
|
|
|
{{ 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-15 13:46:50 +02:00
|
|
|
{{ $str1 := printf "assets%s missing.." $missing }}
|
2022-06-14 23:26:02 +02:00
|
|
|
{{ $str2 := "" }}
|
2022-06-13 04:08:02 +02:00
|
|
|
{{ with .File }}
|
2022-06-14 23:26:02 +02:00
|
|
|
{{ $str2 = printf "content/%sbanner* missing.." .Dir }}
|
2022-06-13 04:08:02 +02:00
|
|
|
{{ 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 }}
|