{{- /* Render markdown image references through Hugo Pipes when the image lives under assets/. PNG/JPEG resources are auto-converted to WebP at build time and served via with the original as fallback. GIFs (animation), SVGs (vector), and external URLs pass through unchanged. */ -}} {{- $src := .Destination -}} {{- $alt := .Text -}} {{- $title := .Title -}} {{- $resourcePath := strings.TrimPrefix "/" $src -}} {{- $resource := "" -}} {{- if not (or (hasPrefix $src "http://") (hasPrefix $src "https://") (hasPrefix $src "//")) -}} {{- $resource = resources.Get $resourcePath -}} {{- end -}} {{- if $resource -}} {{- $sub := $resource.MediaType.SubType -}} {{- if or (eq $sub "png") (eq $sub "jpeg") -}} {{- $webp := $resource.Process "webp" -}} {{ $alt }} {{- else -}} {{ $alt }} {{- end -}} {{- else -}} {{ $alt }} {{- end -}}