Hey everyone,
I’m using image files within my theme to pre-populate some editor fields with demo content.
The images call in the fields.json per module look like
"src": "{{ get_asset_url('...') }}"
Now, my question: in the hubspot page editor, all module entries that rely on images show an wrongly truncated filename, see screenshots. Any idea how to avoid this and only show “clean” filenames?
Thanks a lot in advance
Hey @CBeringer
Have you tried the expression without the wrapping double quotes?
Hey @Kevin-C ,
thanks for your answer. Leavin out the double quotes leads to an validation error “was expecting double-quote to start field name”.
Instead of quotes try using the tojson filter.
"src": {{ get_asset_url('...')|tojson }}
Hey @alyssamwilie ,
thanks for your answer! Sadly it won’t work in this case, because this will not be validated by the Hubspot CLI and therefore not uploaded when using the HS CLI as a watcher. Same error as above (“was expecting double-quote to start field name”)
@CBeringer Tried a bunch of different things, but I think the fields.json just isn’t meant to use HubL.
@alyssamwilie thanks you very much for investigating here. When referring the img src with an relative path without HubL, HS does not resolve the path correctly, so no img found. Alternative would be an absolute url, which is not a good thing when transferring the theme to my clients account. So seems like there’s not a perfect solution for relative src default images in a module.
@CBeringer You could instead just call the URL directly. I believe the structure is --
//f.hubspotusercontent00.net/hubfs/PORTALID/raw_assets/public/image_file.png