| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960 | {{- /* Determine content path for error messages. */}}{{- $path := "" }}{{- with .Page.File }}	{{- $path = .Path }}{{- else }}	{{- $path = .Path }}{{- end }}{{- /* Get image resource. */}}{{- $u := urls.Parse .Destination }}{{- $r := "" }}{{- if $u.IsAbs }}	{{- with resources.GetRemote $u.String }}		{{- with .Err }}			{{- errorf "Unable to get remote image %s: %s. See %s" $u.String . $path }}		{{- else }}			{{- /* Image is a global resource (remote). */}}			{{- $r = . }}		{{- end }}	{{- else }}		{{- errorf "Unable to get remote image %s. See %s" $u.String $path }}	{{- end }}{{- else }}	{{- with .Page.Resources.Get $u.Path }}		{{- /* Image is a page resource. */}}		{{- $r = . }}	{{- else }}		{{- with resources.Get $u.Path }}			{{- /* Image is a global resource (local). */}}			{{- $r = . }}		{{- else }}			{{- errorf "Unable to get image %s. See %s" $u.Path $path }}		{{- end }}	{{- end }}{{- end }}{{- if $r }}	{{- /* Set image element attributes. */}}	{{- $attributes := dict "src" $r.RelPermalink "loading" "lazy" "width" (string $r.Width) "height" (string $r.Height) }}	{{- with .PlainText }}		{{- $attributes = merge $attributes (dict "alt" .) }}	{{- end }}	{{- with .Title }}		{{- $attributes = merge $attributes (dict "title" .) }}	{{- end }}	{{- /* Render image element. */ -}}	{{if .IsBlock -}}	<figure {{ with .Attributes.class }} class="{{ . }}" {{ end }}>		<img {{- range $k, $v :=$attributes }} {{- printf " %s=%q" $k $v | safeHTMLAttr }} {{- end -}}>		{{ with .Title -}}		<figcaption>			<p>{{ . }}</p>		</figcaption>		{{- end }}	</figure>	{{ else }}	<img {{- range $k, $v :=$attributes }} {{- printf " %s=%q" $k $v | safeHTMLAttr }} {{- end -}}>	{{ end }}{{- end -}}
 |