diff --git a/layouts/shortcodes/figure.html b/layouts/shortcodes/figure.html
index 4f641f3b..cd881a31 100644
--- a/layouts/shortcodes/figure.html
+++ b/layouts/shortcodes/figure.html
@@ -7,13 +7,13 @@
{{ $caption := .Get "caption" }}
{{ $href := .Get "href" }}
{{ $class := .Get "class" }}
- {{ $target := .Get "target" }}
+ {{ $target := .Get "target" | default "_blank" }}
{{ $nozoom := .Get "nozoom" | default false }}
+
+
+ {{ with $href }}{{ end }}
{{ if findRE "^https?" $url.Scheme }}
-
-
- {{ with $caption }}{{ . | markdownify }}{{ end }}
-
+
{{ else }}
{{ $resource := "" }}
{{ if $.Page.Resources.GetMatch ($url.String) }}
@@ -22,17 +22,15 @@
{{ $resource = resources.Get ($url.String) }}
{{ end }}
{{ with $resource }}
-
- {{ with $href }}{{ end }}
{{ if $disableImageOptimization }}
{{ else }}
{{ end }}
- {{ if $href }}{{ end }}
- {{ with $caption }}{{ . | markdownify }}{{ end }}
-
{{ else }}
-
-
- {{ with $caption }}{{ . | markdownify }}{{ end }}
-
+
{{ end }}
{{ end }}
+ {{ with $caption }}{{ . | markdownify }}{{ end }}
+ {{ if $href }}{{ end }}
+
{{ end }}