2022-05-06 11:49:30 +02:00
|
|
|
{{ $title := .Title }}
|
|
|
|
{{ $title = singularize $title }}
|
|
|
|
{{ $title = i18n $title }}
|
|
|
|
{{ if not $title }}
|
|
|
|
{{ $title = .Title }}
|
|
|
|
{{ end }}
|
2022-05-09 23:17:23 +02:00
|
|
|
{{ $px := string "400" }}
|
|
|
|
{{ $fill := string (printf "1280x%s smart" $px) }}
|
2022-05-10 04:16:08 +02:00
|
|
|
{{ $all := "" }}
|
2022-05-22 23:49:19 +02:00
|
|
|
{{ $style := safeCSS "text-shadow: 0px 3px 0px #b2a98f, 0px 14px 10px rgba(0,0,0,0.15), 0px 24px 2px rgba(0,0,0,0.1), 0px 34px 30px rgba(0,0,0,0.1)" }}
|
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 }}
|
|
|
|
{{ $banner := printf "/images/banner/%s*" $what }}
|
|
|
|
{{ if resources.GetMatch $banner }}
|
2022-05-09 23:17:23 +02:00
|
|
|
{{ $img = (resources.GetMatch $banner).Fill $fill }}
|
2022-05-06 13:29:00 +02:00
|
|
|
{{ end }}
|
2022-05-09 23:17:23 +02:00
|
|
|
{{ $height := safeCSS (printf "min-height: calc(%spx - 5rem); max-height: calc(%spx - 5rem);" $px $px) }}
|
2022-05-09 21:37:34 +02:00
|
|
|
{{ if and (resources.GetMatch $banner) (ne .Params.banner false) }}
|
2022-05-09 23:01:43 +02:00
|
|
|
{{ $height = safeCSS (printf "height: calc(%spx - 5rem);" (string $img.Height)) }}
|
2022-06-08 00:38:13 +02:00
|
|
|
<div style="background-image: url({{- $img.Permalink -}})" class="banner">
|
2022-06-07 20:15:31 +02:00
|
|
|
{{ if eq hugo.Environment "development" }}
|
|
|
|
<div style="display: flex; flex-direction: column;">
|
2022-06-12 17:24:42 +02:00
|
|
|
{{ end }}
|
|
|
|
|
|
|
|
<h1>{{ $title }}</h1>
|
|
|
|
|
|
|
|
{{ if eq hugo.Environment "development" }}
|
2022-06-07 20:15:31 +02:00
|
|
|
<div>Width: {{ (resources.GetMatch $banner).Width }}px</div>
|
|
|
|
<div>Height: {{ (resources.GetMatch $banner).Height }}px</div>
|
|
|
|
<div>Ratio: {{div (float (resources.GetMatch $banner).Width) (float (resources.GetMatch $banner).Height) }}</div>
|
|
|
|
</div>
|
|
|
|
{{ end }}
|
|
|
|
</div>
|
2022-05-09 21:37:34 +02:00
|
|
|
{{ else if and (.Resources.Match "banner*") (ne .Params.banner false) }}
|
2022-05-09 23:17:23 +02:00
|
|
|
{{ $img = (.Resources.GetMatch "banner*").Fill $fill }}
|
2022-05-09 23:01:43 +02:00
|
|
|
{{ $height = safeCSS (printf "height: calc(%spx - 5rem);" (string $img.Height)) }}
|
2022-06-12 17:24:42 +02:00
|
|
|
<div style="background-image:url({{- $img.Permalink -}})" class="banner">
|
|
|
|
{{ if eq hugo.Environment "development" }}
|
|
|
|
<div style="display: flex; flex-direction: column;">
|
|
|
|
{{ end }}
|
|
|
|
|
|
|
|
<h1>{{ $title }}</h1>
|
|
|
|
|
|
|
|
{{ if eq hugo.Environment "development" }}
|
|
|
|
<div>Width: {{ (index (.Resources.Match "banner*") 0).Width }}px</div>
|
|
|
|
<div>Height: {{ (index (.Resources.Match "banner*") 0).Height }}px</div>
|
|
|
|
<div>Ratio: {{div (float (index (.Resources.Match "banner*") 0).Width) (float (index (.Resources.Match "banner*") 0).Height) }}</div>
|
|
|
|
</div>
|
|
|
|
{{ end }}
|
2022-06-07 20:15:31 +02:00
|
|
|
</div>
|
2022-05-10 04:16:08 +02:00
|
|
|
{{ else if and (.Resources.ByType "image") (ne .Params.banner false) $all }}
|
2022-05-09 23:17:23 +02:00
|
|
|
{{ $img = (index (.Resources.ByType "image") 0).Fill $fill }}
|
2022-05-09 23:01:43 +02:00
|
|
|
{{ $height = safeCSS (printf "height: calc(%spx - 5rem);" (string $img.Height)) }}
|
2022-06-12 17:24:42 +02:00
|
|
|
<div style="background-image: url({{- $img.Permalink -}})" class="banner">
|
|
|
|
{{ if eq hugo.Environment "development" }}
|
|
|
|
<div style="display: flex; flex-direction: column;">
|
|
|
|
{{ end }}
|
|
|
|
|
|
|
|
<h1>{{ $title }}</h1>
|
|
|
|
|
|
|
|
{{ if eq hugo.Environment "development" }}
|
|
|
|
<div>Width: {{ (index (.Resources.ByType "image") 0).Width }}px</div>
|
|
|
|
<div>Height: {{ (index (.Resources.ByType "image") 0).Height }}px</div>
|
|
|
|
<div>Ratio: {{div (float (index (.Resources.ByType "image") 0).Width) (float (index (.Resources.ByType "image") 0).Height) }}</div>
|
|
|
|
</div>
|
|
|
|
{{ end }}
|
2022-06-07 20:15:31 +02:00
|
|
|
</div>
|
2022-05-06 13:29:00 +02:00
|
|
|
{{ else }}
|
2022-06-12 17:24:42 +02:00
|
|
|
<div class="banner">
|
|
|
|
<h1>{{ $title }}</h1>
|
|
|
|
{{ if eq hugo.Environment "development" }}
|
|
|
|
<p>assets/images/banner/{{ $what -}}.* missing..</p>
|
|
|
|
{{ end }}
|
|
|
|
</div>
|
2022-05-06 11:49:30 +02:00
|
|
|
{{ end }}
|