bunteshaus.de/themes/buha/layouts/partials/snippets/banner.html

36 lines
1.5 KiB
HTML
Raw Normal View History

2022-05-06 11:49:30 +02:00
{{ $title := .Title }}
{{ $title = singularize $title }}
{{ $title = i18n $title }}
{{ if not $title }}
{{ $title = .Title }}
{{ end }}
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 }}
{{ $img = resources.GetMatch $banner }}
{{ end }}
2022-05-06 11:49:30 +02:00
2022-05-06 13:29:00 +02:00
{{ if resources.GetMatch $banner }}
2022-05-06 16:07:39 +02:00
<div style="background-image:linear-gradient(rgba(0, 0, 0, 0.4), rgba(0, 0, 0, 0.4)), url({{- $img.Permalink -}}); min-height: 33vh; display: flex; justify-content: center; align-items: center; background-position: bottom center;
background-repeat: no-repeat;
background-size:cover;
background-attachment:fixed; padding-top: 5rem;"><h1 style="font-size: 350%; color: white;">{{ $title }}</h1></div>
2022-05-06 13:29:00 +02:00
{{ else if .Resources.Match "banner*" }}
{{ $img = (.Resources.GetMatch "banner*") }}
2022-05-06 16:07:39 +02:00
<div style="background-image:linear-gradient(rgba(0, 0, 0, 0.4), rgba(0, 0, 0, 0.4)), url({{- $img.Permalink -}}); min-height: 33vh; display: flex; justify-content: center; align-items: center; background-position: bottom center;
background-repeat: no-repeat;
background-size:cover;
background-attachment:fixed; padding-top: 5rem;"><h1 style="font-size: 350%; color: white;">{{ $title }}</h1></div>
2022-05-06 13:29:00 +02:00
{{ else }}
2022-05-06 16:07:39 +02:00
<h1 style="margin-left: 2rem; margin-bottom: 0; color: white; padding-top: 5rem;">{{ $title }}</h1>
2022-05-06 11:49:30 +02:00
{{ end }}