From bbe4eb6285eb1f81fe6ac40eb0392e43452df3d3 Mon Sep 17 00:00:00 2001 From: Jarrod Millman Date: Fri, 8 Mar 2024 11:57:25 -0800 Subject: [PATCH] Use image partial (#540) --- layouts/partials/_elements/image.html | 7 +++++++ layouts/shortcodes/image.html | 8 +------- 2 files changed, 8 insertions(+), 7 deletions(-) create mode 100644 layouts/partials/_elements/image.html diff --git a/layouts/partials/_elements/image.html b/layouts/partials/_elements/image.html new file mode 100644 index 00000000..0161981e --- /dev/null +++ b/layouts/partials/_elements/image.html @@ -0,0 +1,7 @@ +{{- if .data.target -}}{{- end -}} +{{ .data.alt }} +{{- if .data.target }}{{ end -}} diff --git a/layouts/shortcodes/image.html b/layouts/shortcodes/image.html index 3e0ba35c..cd877d6d 100644 --- a/layouts/shortcodes/image.html +++ b/layouts/shortcodes/image.html @@ -34,10 +34,4 @@ */}} {{- $data := .Inner | transform.Unmarshal -}} -{{- if $data.target -}}{{- end -}} -{{ $data.alt }} -{{- if $data.target }}{{ end -}} +{{- partial "_elements/image.html" (dict "data" $data) -}}