small fixes

This commit is contained in:
teldra 2022-05-09 23:17:23 +02:00
parent 96fda4132a
commit 882528e65b
2 changed files with 9 additions and 5 deletions

View File

@ -38,6 +38,8 @@
</a>
<a href="{{- .Permalink -}}" class="no_underline">
<div class="articlecontent">
{{ $px := string "400" }}
{{ $fill := string (printf "1280x%s smart" $px) }}
{{ $metas := dict "when" .Params.when "price" .Params.price }}
{{ $banner := slice }}
{{ $image := slice }}
@ -54,8 +56,8 @@
{{ end }}
{{ $image = .Resources.GetMatch (string $image) }}
{{ if ne $image nil }}
{{ $thumb1 := $image.Fill "1280x480 smart"}}
{{ $thumb = $image}}
{{ $thumb = $image.Fill $fill }}
{{ end }}
{{ partial "snippets/article_metadata" $metas }}

View File

@ -4,6 +4,8 @@
{{ if not $title }}
{{ $title = .Title }}
{{ end }}
{{ $px := string "400" }}
{{ $fill := string (printf "1280x%s smart" $px) }}
{{ $what := "none" }}
{{ $img := "none" }}
@ -16,18 +18,18 @@
{{ end }}
{{ $banner := printf "/images/banner/%s*" $what }}
{{ if resources.GetMatch $banner }}
{{ $img = (resources.GetMatch $banner).Fill "1280x320 smart" }}
{{ $img = (resources.GetMatch $banner).Fill $fill }}
{{ end }}
{{ $height := safeCSS "min-height: calc(320px - 5rem); max-height: calc(320px - 5rem);" }}
{{ $height := safeCSS (printf "min-height: calc(%spx - 5rem); max-height: calc(%spx - 5rem);" $px $px) }}
{{ if and (resources.GetMatch $banner) (ne .Params.banner false) }}
{{ $height = safeCSS (printf "height: calc(%spx - 5rem);" (string $img.Height)) }}
<div style="background-image: linear-gradient(rgba(0, 0, 0, 0.3), rgba(0, 0, 0, 0.1)), url({{- $img.Permalink -}}); {{ $height }}" class="banner banner-shadow"><h1 class="dark-shadow">{{ $title }}</h1></div>
{{ else if and (.Resources.Match "banner*") (ne .Params.banner false) }}
{{ $img = (.Resources.GetMatch "banner*").Fill "1280x320 smart" }}
{{ $img = (.Resources.GetMatch "banner*").Fill $fill }}
{{ $height = safeCSS (printf "height: calc(%spx - 5rem);" (string $img.Height)) }}
<div style="background-image: linear-gradient(rgba(0, 0, 0, 0.3), rgba(0, 0, 0, 0.1)), url({{- $img.Permalink -}}); {{ $height }}" class="banner banner-shadow"><h1 class="dark-shadow">{{ $title }}</h1></div>
{{ else if and (.Resources.ByType "image") (ne .Params.banner false) }}
{{ $img = (index (.Resources.ByType "image") 0).Fill "1280x320 smart" }}
{{ $img = (index (.Resources.ByType "image") 0).Fill $fill }}
{{ $height = safeCSS (printf "height: calc(%spx - 5rem);" (string $img.Height)) }}
<div style="background-image: linear-gradient(rgba(0, 0, 0, 0.3), rgba(0, 0, 0, 0.1)), url({{- $img.Permalink -}}); {{ $height }}" class="banner banner-shadow"><h1 class="dark-shadow">{{ $title }}</h1></div>
{{ else }}