diff --git a/layouts/shortcodes/figure.html b/layouts/shortcodes/figure.html
index 38c727a..9b1dfc6 100644
--- a/layouts/shortcodes/figure.html
+++ b/layouts/shortcodes/figure.html
@@ -1,10 +1,14 @@
+{{ define "img" }}
+
+{{ end }}
+
{{ if .Inner }}
{{ else }}
-
+ {{ template "img" . }}
{{ end }}
diff --git a/layouts/shortcodes/resource.html b/layouts/shortcodes/resource.html
index 1829952..d7b1a0a 100644
--- a/layouts/shortcodes/resource.html
+++ b/layouts/shortcodes/resource.html
@@ -13,15 +13,19 @@
{{ .Scratch.Set "image" ($original.Fill $options) }}
{{ end }}
-{{ $image := .Scratch.Get "image" }}
+
+{{ define "img" }}
+ {{ $image := .Scratch.Get "image" }}
+
+{{ end }}
{{ if .Inner }}
{{ else }}
-
+ {{ template "img" . }}
{{ end }}