2022-02-16 11:03:02 +07:00
|
|
|
{{$src := .Destination | safeURL }}
|
2022-07-02 01:27:50 +07:00
|
|
|
{{$width := index (split .Text "|") 1 | default "auto" }}
|
2022-02-16 11:03:02 +07:00
|
|
|
{{$external := strings.HasPrefix $src "http" }}
|
|
|
|
{{- if $external -}}
|
2022-07-02 01:27:50 +07:00
|
|
|
<img src="{{ $src }}" width="{{ $width }}" alt="{{ .Text }}" {{ with .Title }} title="{{ . }}" {{ end }} />
|
2022-02-16 11:03:02 +07:00
|
|
|
{{- else -}}
|
|
|
|
{{$fixedUrl := (cond (hasPrefix $src "/") $src (print "/" $src)) | urlize}}
|
2022-07-02 01:27:50 +07:00
|
|
|
<img src="{{.Page.Site.BaseURL}}{{ $fixedUrl }}" width="{{ $width }}" alt="{{ .Text }}" {{ with .Title }} title="{{ . }}" {{ end }} />
|
2022-02-16 11:03:02 +07:00
|
|
|
{{- end -}}
|