I have a page template referencing a section template and I am trying to use the context variable to change the default image shown for this section to another image in the theme.
Normally, in the template html, I would reference a theme image with
get_asset_url("../images/theme-image.jpg")
And in the section template
img={ "src": context.image || get_asset_url("../images/another-image.jpg") }
However, in the page template the following gives a template compilation error:
{% include_dnd_partial path="../sections/custom-section.html"
context={image: get_asset_url("../images/theme-image.jpg") }
%}
I’ve tried setting a variable to the asset url and assigning that to image. No error is generated but the image is ignored. E.g.
{% set my_image = get_asset_url("../images/theme-image.jpg") %}
{% include_dnd_partial path='../sections/custom-section.html'
context={
image: my_image
}
%}
What is the correct way to pass an image src value via the context variable to a section template?
