feat: add option to disable zoom in re-written Figure shortcode

Compatible with previous `lightbox` option.
This commit is contained in:
George Cushen 2021-02-19 13:13:00 +00:00
commit eebefd8a59

View file

@ -3,6 +3,7 @@
{{ $destination := .Get "src" }}
{{ $caption := .Get "caption" | default (.Get "title") | default "" }}{{/* Support legacy `title` option. */}}
{{ $zoom := eq (.Get "lightbox" | default "true") "true" }}
{{ $id := anchorize (.Get "id" | default ($caption | plainify)) }}
{{ $alt := .Get "alt" | default ($caption | plainify) }}
@ -19,7 +20,7 @@
<img alt="{{ $alt }}"
src="{{ $img.RelPermalink }}"
loading="lazy"
data-zoomable
{{ if $zoom }}data-zoomable{{end}}
{{ with .Get "width" }}width="{{.}}"{{end}} {{ with .Get "height" }}height="{{.}}"{{end}} />
{{ else }}
{{- $img_lg := $img.Fit "1200x1200" -}}
@ -35,10 +36,10 @@
width="{{ $width }}"
height="{{ $height }}"
loading="lazy"
data-zoomable />
{{ if $zoom }}data-zoomable{{end}} />
{{ end }}
{{- else -}}
<img src="{{ $destination | safeURL }}" alt="{{ $alt }}" loading="lazy" data-zoomable
<img src="{{ $destination | safeURL }}" alt="{{ $alt }}" loading="lazy" {{ if $zoom }}data-zoomable{{end}}
{{ with .Get "width" }}width="{{.}}"{{end}} {{ with .Get "height" }}height="{{.}}"{{end}} />
{{- end -}}