{{ $href := .Destination | safeURL }} {{ if not (strings.HasPrefix .Destination "http") }} {{ $href = (replace .Destination "assets/" "") | safeURL }} {{ end }} {{ $image_ext := path.Ext .Destination }} {{ $text := .Text | plainify }} {{ $title := .Title | plainify}} {{ $context := (dict "context" . "Destination" .Destination "Title" $title "Text" $text )}}
{{- if (strings.HasPrefix .Destination "http") -}} {{ $text }} {{- else if (strings.HasSuffix $image_ext "svg") -}} {{ partial "compressed-svg.html" $context}} {{- else if (strings.HasSuffix $image_ext "gif") -}} {{ partial "compressed-gif.html" $context}} {{- else -}} {{ partial "compressed-image.html" $context}} {{- end -}} {{ if .Title }}
{{ .Title | safeHTML }}
{{ else if .Text }}
{{ .Text | safeHTML }}
{{ end }}