diff --git a/layouts/shortcodes/fig.html b/layouts/shortcodes/fig.html
index c0b09cf..31a3c6f 100644
--- a/layouts/shortcodes/fig.html
+++ b/layouts/shortcodes/fig.html
@@ -33,9 +33,7 @@
Figure {{ $.Page.Scratch.Get "fig" }}. {{ $fig.Get "caption" | markdownify | plainify }}
{{ if .Get "attr" }}
- [{{ with .Get "attrlink"}}{{ end }}
- {{ .Get "attr" | markdownify }}
- {{ if .Get "attrlink"}}{{ end }}]
+ [{{- with .Get "attrlink"}}{{ end }}{{ .Get "attr" | markdownify }}{{ if .Get "attrlink"}}{{ end -}}]
{{ end }}