fixed the figure shortcode to play well with our img shortcode.
[theme-danix.xyz.git] / layouts / shortcodes / figure.html
1 {{/*
2 * This version of the figure shortcode needs to be closed and doesn't
3 * add an image itself, but relies on the img.html shortcode to provide
4 * a responsive image instead.
5 */}}
6 <figure{{ with .Get "class" }} class="{{ . }}"{{ end }}>
7 {{- if .Get "link" -}}
8 <a href="{{ .Get "link" }}"{{ with .Get "target" }} target="{{ . }}"{{ end }}{{ with .Get "rel" }} rel="{{ . }}"{{ end }}>
9 {{- end -}}
10 {{- .Inner -}}
11 {{- if .Get "link" }}</a>{{ end -}}
12 {{- if or (or (.Get "title") (.Get "caption")) (.Get "attr") -}}
13 <figcaption>
14 {{ with (.Get "title") -}}
15 <h4>{{ . }}</h4>
16 {{- end -}}
17 {{- if or (.Get "caption") (.Get "attr") -}}<p>
18 {{- .Get "caption" | markdownify -}}
19 {{- with .Get "attrlink" }}
20 <a href="{{ . }}">
21 {{- end -}}
22 {{- .Get "attr" | markdownify -}}
23 {{- if .Get "attrlink" }}</a>{{ end }}</p>
24 {{- end }}
25 </figcaption>
26 {{- end }}
27 </figure>