diff --git a/layouts/shortcodes/figure.html b/layouts/shortcodes/figure.html
index fff42ad..90bf2e6 100644
--- a/layouts/shortcodes/figure.html
+++ b/layouts/shortcodes/figure.html
@@ -1,23 +1,28 @@
-{{ $original := .Page.Resources.GetMatch (printf "*%s*" (.Get "img")) }}
+{{ $img := .Get "img" }}
+{{ $caption := .Get "caption" }}
+{{ $command := .Get "command" }}
+{{ $options := .Get "options" }}
+
+{{ $original := .Page.Resources.GetMatch (printf "*%s*" $img) }}
{{ $new := "" }}
-{{ if eq (.Get "command") "Fit" }}
- {{ $new = $original.Fit (.Get "options") }}
-{{ else if eq (.Get "command") "Fill" }}
- {{ $new = $original.Fill (.Get "options") }}
-{{ else if eq (.Get "command") "Resize" }}
- {{ $new = $original.Resize (.Get "options") }}
-{{ else if eq (.Get "command") "Original" }}
+{{ if eq $command "Fit" }}
+ {{ $new = $original.Fit $options }}
+{{ else if eq $command "Fill" }}
+ {{ $new = $original.Fill $options }}
+{{ else if eq $command "Resize" }}
+ {{ $new = $original.Resize $options }}
+{{ else if eq $command "Original" }}
{{ $new = $original }}
{{ else }}
{{ errorf "Invalid image processing command: Must be one of Fit, Fill, Resize, Original." }}
{{ end }}
-