2022-02-06 00:26:37 +00:00
|
|
|
{{ $url := urls.Parse .Destination }}
|
2022-01-12 03:21:22 +00:00
|
|
|
{{ $altText := .Text }}
|
|
|
|
{{ $caption := .Title }}
|
2023-10-31 16:53:15 +00:00
|
|
|
{{ $class := "mx-auto my-0 rounded-md" }}
|
|
|
|
|
|
|
|
{{ $file := $url.Path }}
|
|
|
|
{{ $img := .Page.Resources.GetMatch $file }}
|
|
|
|
{{- if and (not $img) .Page.File }}
|
|
|
|
{{ $path := path.Join .Page.File.Dir $file }}
|
|
|
|
{{ $img = resources.Get $path }}
|
|
|
|
{{ end -}}
|
|
|
|
|
|
|
|
<figure>
|
|
|
|
{{- with $img -}}
|
|
|
|
{{ partial "pictureDefaults.html" (dict "img" . "alt" $altText "class" $class) }}
|
|
|
|
{{- else -}}
|
|
|
|
<img src="{{ .Destination | safeURL }}" alt="{{ $altText }}" class="{{ $class }}"/>
|
|
|
|
{{- end -}}
|
|
|
|
{{ with $caption }}<figcaption class="text-center">{{ . | markdownify }}</figcaption>{{ end }}
|
|
|
|
</figure>
|