mirror of https://github.com/jpanther/congo.git
29 lines
898 B
HTML
29 lines
898 B
HTML
{{ $url := urls.Parse .Destination }}
|
|
{{ $altText := .Text }}
|
|
{{ $caption := .Title }}
|
|
{{ $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 -}}
|
|
|
|
{{/* https://github.com/gohugoio/hugo/pull/10666/files */}}
|
|
{{- $params := $url.Query -}}
|
|
{{- $x2Param := $params.Get "x2" -}}
|
|
{{- $x2 := false -}}
|
|
{{- if eq $x2Param "true" -}}
|
|
{{- $x2 = true -}}
|
|
{{- end -}}
|
|
|
|
<figure>
|
|
{{- with $img -}}
|
|
{{ partial "pictureDefaults.html" (dict "img" . "alt" $altText "class" $class "x2" $x2) }}
|
|
{{- else -}}
|
|
<img src="{{ .Destination | safeURL }}" alt="{{ $altText }}" class="{{ $class }}"/>
|
|
{{- end -}}
|
|
{{ with $caption }}<figcaption class="text-center">{{ . | markdownify }}</figcaption>{{ end }}
|
|
</figure>
|