forked from Bunteshaus/bunteshaus.de
124 lines
5.4 KiB
HTML
124 lines
5.4 KiB
HTML
{{ $title := .Title }}
|
|
{{ $title = singularize $title }}
|
|
{{ $title = i18n $title }}
|
|
{{ if not $title }}
|
|
{{ $title = .Title }}
|
|
{{ end }}
|
|
{{ $good_w := "1920"}}
|
|
{{ $good_h := "550"}}
|
|
{{ $what := "none" }}
|
|
{{ $img := "none" }}
|
|
{{ if eq .Kind "home" }}
|
|
{{ $what = "home" }}
|
|
{{ else }}
|
|
{{ with .File }}
|
|
{{ $what = .File.ContentBaseName }}
|
|
{{ end }}
|
|
{{ end }}
|
|
{{ $title_class := safeCSS "title" }}
|
|
{{ if .IsHome }}
|
|
{{ $title_class = safeCSS "title_index" }}
|
|
{{ end }}
|
|
{{ $banner := printf "/images/banner/%s*" $what }}
|
|
{{ if resources.GetMatch $banner }}
|
|
{{ $img = resources.GetMatch $banner }}
|
|
{{ end }}
|
|
{{ if and (resources.GetMatch $banner) (ne .Params.banner false) }}
|
|
<div style="background-image: url({{- $img.Permalink -}})" class="banner">
|
|
{{ if not .IsHome }}<h1 class="{{ $title_class }}">{{ $title }}</h1> {{ end }}
|
|
{{ if eq hugo.Environment "development" }}
|
|
<div>
|
|
{{ $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 }}
|
|
</div>
|
|
{{ end }}
|
|
</div>
|
|
{{ else if and (.Resources.Match "banner*") (ne .Params.banner false) }}
|
|
{{ $img = .Resources.GetMatch "banner*" }}
|
|
<div style="background-image:url({{- $img.Permalink -}})" class="banner">
|
|
{{ if not .IsHome }}<h1 class="{{ $title_class }}">{{ $title }}</h1> {{ end }}
|
|
{{ if eq hugo.Environment "development" }}
|
|
<div>
|
|
{{ $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 }}
|
|
</div>
|
|
{{ end }}
|
|
</div>
|
|
{{ else if and (.Resources.ByType "image") (ne .Params.banner false) (not true) }}
|
|
{{ $img = index (.Resources.ByType "image") 0 }}
|
|
<div style="background-image: url({{- $img.Permalink -}})" class="banner">
|
|
{{ if not .IsHome }}<h1 class="{{ $title_class }}">{{ $title }}</h1> {{ end }}
|
|
{{ if eq hugo.Environment "development" }}
|
|
<div>
|
|
{{ $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 }}
|
|
</div>
|
|
{{ end }}
|
|
</div>
|
|
{{ else }}
|
|
<div class="banner">
|
|
{{ if not .IsHome }}<h1 class="{{ $title_class }}">{{ $title }}</h1> {{ end }}
|
|
{{ if eq hugo.Environment "development" }}
|
|
<p>
|
|
assets/images/banner/{{ $what -}}.* missing..<br>
|
|
or<br>
|
|
{{ with .File }}content/{{ .Dir }}/banner* missing..{{ end }}
|
|
</p>
|
|
{{ end }}
|
|
</div>
|
|
{{ end }}
|