2024-05-07 16:17:24 +00:00
|
|
|
<!---
|
|
|
|
Fig img shortcode
|
|
|
|
-->
|
|
|
|
{{- if .Get "single" -}}
|
|
|
|
<div class="single-figure-container">
|
|
|
|
{{ end }}
|
2023-09-21 21:19:37 +00:00
|
|
|
<figure class="fig-img {{ with .Get "class" }}{{ . }}{{ end }}">
|
|
|
|
{{- if .Get "link" -}}
|
|
|
|
<a href="{{ .Get "link" }}"{{ with .Get "target" }} target="{{ . }}"{{ end }}{{ with .Get "rel" }} rel="{{ . }}"{{ end }}>
|
|
|
|
{{- end -}}
|
|
|
|
|
2024-05-07 16:17:24 +00:00
|
|
|
{{ $options := or (.Get "options") "500x500 center" }}
|
|
|
|
{{ $permalink := "" }}
|
|
|
|
{{ if hasPrefix (.Get "src") "https://" }}
|
|
|
|
{{ $permalink = .Get "src" }}
|
|
|
|
{{ else }}
|
2024-12-22 22:32:45 +00:00
|
|
|
{{ $resource := .Page.Resources.GetMatch (.Get "src") }}
|
|
|
|
{{ if not $resource }}
|
|
|
|
{{ $resource = .Page.Parent.Resources.GetMatch (.Get "src") }}
|
|
|
|
{{- end -}}
|
|
|
|
{{ if $resource }}
|
|
|
|
{{ $permalink = ($resource.Fill $options).Permalink }}
|
|
|
|
{{- end -}}
|
2024-05-07 16:17:24 +00:00
|
|
|
{{- end -}}
|
|
|
|
|
|
|
|
<img src="{{ $permalink }}"
|
2023-09-21 21:19:37 +00:00
|
|
|
{{- if or (.Get "alt") (.Get "caption") }}
|
|
|
|
alt="{{ with .Get "alt" }}{{ . }}{{ else }}{{ .Get "caption" | markdownify| plainify }}{{ end }}"
|
|
|
|
{{- end -}}
|
|
|
|
/><!-- Closing img tag -->
|
|
|
|
{{- if .Get "link" }}</a>{{ end -}}
|
|
|
|
{{- if or (or (.Get "title") (.Get "caption")) (.Get "attr") -}}
|
|
|
|
<figcaption>
|
|
|
|
{{ with (.Get "title") -}}
|
|
|
|
<h4>{{ . }}</h4>
|
|
|
|
{{- 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>
|
2024-05-07 16:17:24 +00:00
|
|
|
{{- if .Get "single" -}}
|
|
|
|
</div>
|
|
|
|
{{ end }}
|