Files
xuesheng/themes/ink-free/layouts/shortcodes/figure.html
2025-07-10 15:45:00 +08:00

36 lines
1.2 KiB
HTML

<!-- image -->
<figure {{ with .Get "class" }}class="{{.}}"{{ end }}>
{{ with .Get "link" }}<a href="{{ . }}">{{ end }}
<img src="{{ .Get "src" }}"
{{ if or (.Get "alt") (.Get "caption") }}alt="{{ with .Get "alt" }}{{ . }}{{ else }}{{ .Get "caption" }}{{ end }}"{{ end }} />
{{ if .Get "link" }}</a>{{ end }}
{{ if or (or (.Get "title") (.Get "caption")) (.Get "attr") }}
<figcaption>
{{ if isset .Params "title" }}
{{ .Get "title" }}
{{ end }}
{{ if or (.Get "caption") (.Get "attr") }}
<p style="margin: -0.5rem 0 0 0;">
{{ .Get "caption" }}
{{ with .Get "attrlink" }}
<a href="{{ . }}">
{{ end }}
{{ if .Get "attr" }}
<small style="margin: -0.5rem 0 0 0;">
[{{ .Get "attr" }}]
</small>
{{ end }}
{{ if .Get "attrlink" }}</a>
{{ end }}
</p>
{{ end }}
</figcaption>
{{ end }}
</figure>
<!-- image -->