CMS Development

CBeringer
Participant

Editor display bug: private truncated string

SOLVE

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?

 

Bildschirmfoto 2021-04-20 um 09.34.38.pngBildschirmfoto 2021-04-20 um 09.34.55.png

 

Thanks a lot in advance

0 Upvotes
1 Accepted solution
alyssamwilie
Solution
Recognized Expert | Elite Partner
Recognized Expert | Elite Partner

Editor display bug: private truncated string

SOLVE

@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

If this answer solved your question, please mark it as the solution.

Alyssa Wilie Profile Image

Alyssa Wilie

Web Developerat Lynton

Learn HubL | Get Marketing Insights

HubSpot Elite Solutions Partner
Lynton's HubSpot theme Rubric now available. Click to download.

View solution in original post

7 Replies 7
alyssamwilie
Solution
Recognized Expert | Elite Partner
Recognized Expert | Elite Partner

Editor display bug: private truncated string

SOLVE

@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

If this answer solved your question, please mark it as the solution.

Alyssa Wilie Profile Image

Alyssa Wilie

Web Developerat Lynton

Learn HubL | Get Marketing Insights

HubSpot Elite Solutions Partner
Lynton's HubSpot theme Rubric now available. Click to download.
alyssamwilie
Recognized Expert | Elite Partner
Recognized Expert | Elite Partner

Editor display bug: private truncated string

SOLVE

@CBeringer Tried a bunch of different things, but I think the fields.json just isn't meant to use HubL.

If this answer solved your question, please mark it as the solution.

Alyssa Wilie Profile Image

Alyssa Wilie

Web Developerat Lynton

Learn HubL | Get Marketing Insights

HubSpot Elite Solutions Partner
Lynton's HubSpot theme Rubric now available. Click to download.
CBeringer
Participant

Editor display bug: private truncated string

SOLVE

@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.

0 Upvotes
alyssamwilie
Recognized Expert | Elite Partner
Recognized Expert | Elite Partner

Editor display bug: private truncated string

SOLVE

Instead of quotes try using the tojson filter.

 

"src": {{ get_asset_url('...')|tojson }}

If this answer solved your question, please mark it as the solution.

Alyssa Wilie Profile Image

Alyssa Wilie

Web Developerat Lynton

Learn HubL | Get Marketing Insights

HubSpot Elite Solutions Partner
Lynton's HubSpot theme Rubric now available. Click to download.
CBeringer
Participant

Editor display bug: private truncated string

SOLVE

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")

0 Upvotes
CBeringer
Participant

Editor display bug: private truncated string

SOLVE

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".

Kevin-C
Recognized Expert | Partner
Recognized Expert | Partner

Editor display bug: private truncated string

SOLVE

Hey @CBeringer 

 

Have you tried the expression without the wrapping double quotes?

Kevin Cornett - Sr. Solutions Architect @ BridgeRev