{{- $u := urls.Parse .Destination -}} {{- $src := $u.String -}} {{- $figcaption := .Title | markdownify -}} {{- $captionWidth := 0 -}} {{- if not $u.IsAbs -}} {{- $path := strings.TrimPrefix "./" $u.Path }} {{- with or (.PageInner.Resources.Get $path) (resources.Get $path) -}} {{- if gt .Width 1400 -}} {{- $src = (.Resize "1400x webp q50").RelPermalink -}} {{- else -}} {{- $src = (.Process "webp q50").RelPermalink -}} {{- end -}} {{- with $u.RawQuery -}} {{- $src = printf "%s?%s" $src . -}} {{- end -}} {{- with $u.Fragment -}} {{- $src = printf "%s#%s" $src . -}} {{- end -}} {{- $captionWidth = .Width -}} {{- end -}} {{- end -}} {{- $attributes := merge .Attributes (dict "alt" .Text "src" $src "title" .Text) -}} {{- with $figcaption -}}
{{- . -}}
{{- end -}}
{{- /**/ -}}