23 lines
626 B
HTML
23 lines
626 B
HTML
{{- $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 := cond $isRemote (resources.GetRemote $src) (resources.Get $src) -}}
|
|
|
|
{{- $result = (dict "image" $image "title" $title "alt" $alt) -}}
|
|
{{- end -}}
|
|
|
|
{{- return $result -}}
|