{{ $sizes := slice "320" "640" "960" "1280" }} {{ $mediaWidthControl := "(max-width: 360px) 320px, (max-width: 680px) 640px, (max-width: 1100px) 960px, 1280px" }} {{ $id := .id }} {{ $style := .style }} {{ $alt := .alt }} {{ $caption := .caption }} {{ $width := .width }} {{ $height := .height }} {{ $img := .Page.Resources.GetMatch .url }} {{ if not $img }} {{ $img = resources.Get .url }} {{ if not $img }} {{ $img := resources.GetRemote .url | resources.Copy (path.Join "images" (path.Base .url )) }} {{ end }} {{ end }} {{ with $img }} {{ $url := .RelPermalink }} {{ $type := .MediaType.SubType }} {{ $ext := path.Ext $url }} {{ $name := path.Base (replace $url $ext "") }} {{ $dir := path.Dir $url }} {{ if eq $type "svg" }} {{ $alt }} {{ else }} {{ $alt }} {{ end }} {{ if $caption }}

{{ $caption }}

{{ end }} {{ end }} {{/* https://www.brycewray.com/posts/2023/05/better-code-image-processing-hugo-render-hook-edition/ */}}