Factor out stretch var

This commit is contained in:
Will Faught
2023-02-05 19:44:11 -08:00
parent 925cb18075
commit 038b48bfc2

View File

@@ -1,14 +1,16 @@
{{ define "main" }} {{ define "main" }}
{{ $page := . }} {{ $page := . }}
{{ $stretch := $page.Param "paige.home.image.stretch" }}
<article> <article>
{{ partial "paige/metadata.html" $page }} {{ partial "paige/metadata.html" $page }}
<section> <section>
{{ if $page.Param "paige.home.image.url" }} {{ if $page.Param "paige.home.image.url" }}
{{ $class := cond ($page.Param "paige.home.image.stretch" | not) "mw-100 rounded-4 shadow" "rounded-4 shadow w-100" }} {{ $class := cond ($stretch | not) "mw-100 rounded-4 shadow" "rounded-4 shadow w-100" }}
{{ $style := cond ($page.Param "paige.home.image.stretch" | not) "height: 20rem" "height: 20rem; object-fit: cover" }} {{ $style := cond ($stretch | not) "height: 20rem" "height: 20rem; object-fit: cover" }}
<p {{ if not ($page.Param "paige.home.image.stretch") }} class="text-center" {{ end }}> <p {{ if not $stretch }} class="text-center" {{ end }}>
{{ partial "paige/img.html" (dict {{ partial "paige/img.html" (dict
"class" $class "class" $class
"fetchpriority" "high" "fetchpriority" "high"