mirror of
https://github.com/gcushen/hugo-academic.git
synced 2025-07-26 03:00:50 +02:00
feat: add option to disable zoom in re-written Figure shortcode
Compatible with previous `lightbox` option.
This commit is contained in:
parent
55fd017f98
commit
eebefd8a59
1 changed files with 4 additions and 3 deletions
|
@ -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 -}}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue