Add gallery maxheight param

master
Will Faught 2 years ago
parent b18516d29c
commit 385f2105ae

@ -7,6 +7,7 @@
{{ $fingerprint := $params.fingerprint | default true }} {{ $fingerprint := $params.fingerprint | default true }}
{{ $height := $params.height }} {{ $height := $params.height }}
{{ $loading := $params.loading | default "lazy" }} {{ $loading := $params.loading | default "lazy" }}
{{ $maxheight := $params.maxheight }}
{{ $maxwidth := $params.maxwidth }} {{ $maxwidth := $params.maxwidth }}
{{ $method := $params.method }} {{ $method := $params.method }}
{{ $options := $params.options }} {{ $options := $params.options }}
@ -56,11 +57,11 @@
{{ $src = $resource.RelPermalink }} {{ $src = $resource.RelPermalink }}
{{ end }} {{ end }}
{{ if and $height (not (or $maxwidth $width)) }} {{ if and (or $height $maxheight) (not (or $maxwidth $width)) }}
{{ $width = "auto" }} {{ $width = "auto" }}
{{ end }} {{ end }}
{{ if and (or $maxwidth $width) (not $height) }} {{ if and (or $maxwidth $width) (not (or $height $maxheight)) }}
{{ $height = "auto" }} {{ $height = "auto" }}
{{ end }} {{ end }}
@ -74,6 +75,16 @@
{{ end }} {{ end }}
{{ end }} {{ end }}
{{ if $maxheight }}
{{ with printf "max-height: %v" $maxheight }}
{{ if $style }}
{{ $style = printf "%v; %v" $style . }}
{{ else }}
{{ $style = . }}
{{ end }}
{{ end }}
{{ end }}
{{ if $maxwidth }} {{ if $maxwidth }}
{{ with printf "max-width: %v" $maxwidth }} {{ with printf "max-width: %v" $maxwidth }}
{{ if $style }} {{ if $style }}

@ -2,6 +2,7 @@
{{ $height := .Get "height" }} {{ $height := .Get "height" }}
{{ $images := .Get 0 | default (.Get "images") }} {{ $images := .Get 0 | default (.Get "images") }}
{{ $justify := .Get "justify" | default "center" }} {{ $justify := .Get "justify" | default "center" }}
{{ $maxheight := .Get "maxheight" }}
{{ $maxwidth := .Get "maxwidth" }} {{ $maxwidth := .Get "maxwidth" }}
{{ $method := .Get "method" | default "resize" }} {{ $method := .Get "method" | default "resize" }}
{{ $options := .Get "options" | default "550x webp picture Lanczos" }} {{ $options := .Get "options" | default "550x webp picture Lanczos" }}
@ -39,6 +40,7 @@
{{ partial "paige/a.html" (dict {{ partial "paige/a.html" (dict
"content" (partial "paige/img.html" (dict "content" (partial "paige/img.html" (dict
"height" $height "height" $height
"maxheight" $maxheight
"maxwidth" $maxwidth "maxwidth" $maxwidth
"method" $method "method" $method
"options" $options "options" $options
@ -61,6 +63,7 @@
{{ partial "paige/a.html" (dict {{ partial "paige/a.html" (dict
"content" (partial "paige/img.html" (dict "content" (partial "paige/img.html" (dict
"height" $height "height" $height
"maxheight" $maxheight
"maxwidth" $maxwidth "maxwidth" $maxwidth
"method" $method "method" $method
"options" $options "options" $options

Loading…
Cancel
Save