<figure class="figure{{ with .Get "class" }} {{ . }}{{ end }}">
    <a href="{{ .Get "src" }}" class="d-block" data-toggle="lightbox" data-gallery="post-gallery">
        <img src="{{ .Get "src" }}"
             {{- if or (.Get "alt") (.Get "caption") }}
             alt="{{ with .Get "alt" }}{{ . }}{{ else }}{{ .Get "caption" | markdownify| plainify }}{{ end }}"
             {{- end -}}
             {{- with .Get "width" }} width="{{ . }}"{{ end -}}
             {{- with .Get "height" }} height="{{ . }}"{{ end -}}
             class="figure-img img-fluid"
        /> <!-- Closing img tag -->
    </a>
    {{- if or (or (.Get "title") (.Get "caption")) (.Get "attr") -}}
        <figcaption class="figure-caption text-center">
            {{ with (.Get "title") -}}
                {{ . }}
            {{- end -}}
            {{- if or (.Get "caption") (.Get "attr") -}}<p>
                {{- .Get "caption" | markdownify -}}
                {{- with .Get "attrlink" }}
                    <a href="{{ . }}">
                {{- end -}}
                {{- .Get "attr" | markdownify -}}
                {{- if .Get "attrlink" }}</a>{{ end }}</p>
            {{- end }}
        </figcaption>
    {{- end }}
</figure>
