{{- $src := (.Destination | safeURL) -}} {{ $src = replace $src "./" "" }} {{- $fragments := (split $src "#") -}} {{- $src = index ($fragments) 0 -}} {{- $imgwidth := .Page.Scratch.Get "imgwidth" | default 800 -}} {{/*- $src = path.Base $src -*/}} {{- with (.Page.Resources.ByType "image").GetMatch (printf "**%s" $src) -}} {{/* with (.Page.Resources.GetMatch $src) */}} {{- if strings.HasSuffix $src ".svg" -}} {{ .Content | safeHTML }} {{- else -}} {{ $resized := . }} {{ if (gt .Width $imgwidth) }} {{ if hugo.IsExtended }} {{- $resized = .Resize (print $imgwidth "x webp") -}} {{ else }} {{- $resized = .Resize (print $imgwidth "x") -}} {{ end }} {{ end }} {{ $placeholder := "" }} {{- if or (eq .MediaType.SubType "jpg") (eq .MediaType.SubType "jpeg") }} {{ $placeholder = .Resize "48x q20 jpg Gaussian" }} {{ end -}} {{- if (eq .MediaType.SubType "gif") }} {{ $resized = . }} {{ end -}} {{ with $.Title }}
{{ end }} {{ $.Text }} {{ with $.Title }}
{{ . | markdownify }}
{{ end }} {{- end -}} {{- else -}} {{ .Text }} {{- end -}}