I’m deplying to Netlify, so I need to store all images that will be CMS-editable in a directory in /content, as documented in this solution. It works well in my layout files, but when I try to drop it into a partial it won’t work. I can print out $img below line 1 in the example below, but the <img>
tag is never generated. I’m passing in the context when calling the partial: {{ partial "person.html" . }}
. No errors when running the server or plain build script, nothing shows up with the --verbose
option. Not sure what else I should be looking at to troubleshoot…
{{ $img := strings.TrimPrefix "/uploads/" .image }}
{{ $name := .name }}
{{ with $.Site.GetPage "page" "uploads/_index.md" }}
{{ with .Resources.GetMatch $img }}
{{$imgFill := .Fill "124x124 Center"}}
<img class="" src="{{ $imgFill.RelPermalink }}" width="124" height="124" alt="Photo of {{ $name }}" tabindex="0">
{{ end }}
{{ end }}