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 }}
|
2023-12-26 00:22:55 +00:00
|
|
|
{{ $path := path.Join .Page.File.Dir $file }}
|
|
|
|
{{ $img = resources.Get $path }}
|
2023-10-31 16:53:15 +00:00
|
|
|
{{ end -}}
|
|
|
|
|
2023-11-26 13:38:27 +00:00
|
|
|
{{/* https://github.com/gohugoio/hugo/pull/10666 */}}
|
2023-11-26 01:23:34 +00:00
|
|
|
{{- $params := $url.Query -}}
|
2023-11-26 13:23:42 +00:00
|
|
|
{{- $x2Param := $params.Get "2x" -}}
|
2023-11-26 01:23:34 +00:00
|
|
|
{{- $x2 := false -}}
|
|
|
|
{{- if eq $x2Param "true" -}}
|
2023-12-26 00:22:55 +00:00
|
|
|
{{- $x2 = true -}}
|
2023-11-26 01:23:34 +00:00
|
|
|
{{- end -}}
|
|
|
|
|
2023-10-31 16:53:15 +00:00
|
|
|
<figure>
|
|
|
|
{{- with $img -}}
|
2023-11-26 13:47:26 +00:00
|
|
|
{{ partial "picture.html" (dict "img" . "alt" $altText "class" $class "x2" $x2) }}
|
2023-10-31 16:53:15 +00:00
|
|
|
{{- else -}}
|
2023-12-26 00:22:55 +00:00
|
|
|
<img src="{{ .Destination | safeURL }}" alt="{{ $altText }}" class="{{ $class }}" />
|
2023-10-31 16:53:15 +00:00
|
|
|
{{- end -}}
|
|
|
|
{{ with $caption }}<figcaption class="text-center">{{ . | markdownify }}</figcaption>{{ end }}
|
|
|
|
</figure>
|