culinary.kemonine.info/themes/hugo-recipes/layouts/shortcodes/img.html
2022-12-03 10:27:03 -05:00

33 lines
1 KiB
HTML

<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 }}
{{ with .Get "mouse" -}}
title="{{ . }}"
{{- end -}}
/>
{{ if .Get "link" }}</a>{{ end }}
{{ if or (or (.Get "title") (.Get "caption")) (.Get "attr") }}
<figcaption>
{{ if isset .Params "title" }}
<h4>{{ .Get "title" }}</h4>
{{ end }}
{{ if or (.Get "caption") (.Get "attr") }}
<p>
{{ .Get "caption" }}
{{ with .Get "attrlink"}}<a href="{{.}}">{{ end }}
{{ .Get "attr" }}
{{ if .Get "attrlink"}}
</a>
{{ end }}
</p>
{{ end }}
</figcaption>
{{ end }}
</figure>