{{- $input := . -}} {{- $src := $input -}} {{- $title := "" -}} {{- $alt := "" -}} {{- if reflect.IsMap $input -}} {{- $src = $input.src | default $input.path | default "" -}} {{- $title = $input.title | default $input.caption | default "" -}} {{- $alt = $input.alt | default $title -}} {{- end -}} {{ $result := dict "image" nil "title" $title "alt" $alt }} {{- if $src -}} {{- $isRemote := strings.HasPrefix $src "http" -}} {{- $image := "" -}} {{- if $isRemote -}} {{- $remote := resources.GetRemote $src -}} {{- $image = resources.Copy (printf "static/3rd-party/%s" $remote.Name) $remote -}} {{- else -}} {{- $image = resources.Get $src -}} {{- end -}} {{- $result = (dict "image" $image "title" $title "alt" $alt) -}} {{- end -}} {{- return $result -}}