I have this Scriban template:
{{
mediaId = sc_field i_item 'DropLinkField'
item_By_Id = (sc_getitem mediaId)
item_harcoded = "{ADAF43DF-BFD6-4444-9FE9-A030AB70B873}"
get_the_url = (sc_getitem item_harcoded)
}}
<p>MediaId = {{mediaId}}</p>
<p>item_By_Id = {{item_By_Id}}</p>
<p>get_the_url = {{get_the_url}}</p>
<img src = "{{item_By_Id.media_url}}"/>
<img src="{{get_the_url.media_url}}"/>
Output
mediaId
:{ADAF43DF-BFD6-4444-9FE9-A030AB70B873}
item_By_Id
:get_the_url
:/sitecore/media library/Project/Experiment/KV/First/linkedin_icon
- Image is displayed for the
get_the_url
one
If I put the 2nd last image tag (the one with the item_By_Id
) then I get this error:
Scriban(11,26) : error : Cannot get the member item_By_Id.media_url for a null object.
Sitecore Scriban doesn't seem to support dynamic values. As from the output I can see that item_By_Id
is empty.