{{ $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 */}} {{- $params := $url.Query -}} {{- $x2Param := $params.Get "2x" -}} {{- $x2 := false -}} {{- if eq $x2Param "true" -}} {{- $x2 = true -}} {{- end -}}
{{- with $img -}} {{ $lazy := $.Page.Site.Params.enableImageLazyLoading | default true }} {{ $webp := $.Page.Site.Params.enableImageWebp | default true }} {{ partial "picture.html" (dict "img" . "alt" $altText "class" $class "x2" $x2 "lazy" $lazy "webp" $webp) }} {{- else -}} {{ $altText }} {{- end -}} {{ with $caption }}
{{ . | markdownify }}
{{ end }}