I can’t set a .scratch value from within a partial.
{{ $.Scratch.Set srcset (delimit $src
,
) }}
{{ $.Scratch.Set home_medium $medium.RelPermalink }}
gives
Error: error building site: “/home/drm/WEBSITE/content/docs/Biology/fallen.md:1:1”: “/home/drm/WEBSITE/layouts/_default/_markup/render-image.html:76:4”: execute of template failed: template: _default/_markup/render-image.html:76:4: executing “_default/_markup/render-image.html” at <partial “WithFigure” .>: error calling partial: execute of template failed: template: home/_markup/render-image.html:72:4: executing “partials/WithFigure” at <partial “ImagePartial” .>: error calling partial: execute of template failed: template: home/_markup/render-image.html:60:5: executing “partials/ImagePartial” at <$.Scratch.Set>: can’t evaluate field Scratch in type goldmark.imageLinkContext
I read the previous post .Scratch within partial range but it did not actually provide an answer, as to of why the OP couldn’t retrieve a scratch value set inside a partial. But maybe it’s unrelated since he could set it, not get it, my case seems to be opposite.
My code lies within {{ define "partials/ImagePartial" }}
, inside “/layouts/home/_markup/render-image.html”, called only for the homepage.