CMS Development

arcknowledge
Member

Assets missing protocol using get_asset_url

SOLVE

Hey Folks,

 

Hoping someone may be able to help guide me to a solution on an issue I am encountering with links to assets in my css files.  So far this issue appears to be isolated to font files, but I am not sure why.

 

When I link the fonts via CSS using get_asset_url, the generated url is missing protocol (https) in the URL.

 

Hubspot CSS entry

url( {{ get_asset_url('../fonts/fa-solid-900.woff2') }} )

 

Hubspot Generated URL

url(//45725153.fs1.hubspotusercontent-na1.net/hubfs/45725153/raw_assets/public/arc-k_dev_theme/assets/fonts/fa-solid-900.woff2)

 

I have attempted to link the full path and relative path to the file.  In both events, the protocol (https) is missing from the URL.

 

When I add the protocol (https) to the URL, the file is there.

 

https://45725153.fs1.hubspotusercontent-na1.net/hubfs/45725153/raw_assets/public/arc-k_dev_theme/assets/fonts/fa-solid-900.woff2

 

I really appreciate any help someone can provide!

0 Upvotes
2 Accepted solutions
SteveHTM
Solution
Key Advisor | Platinum Partner
Key Advisor | Platinum Partner

Assets missing protocol using get_asset_url

SOLVE

@arcknowledge - strangely - and I don't know why this is the case - the HubL function seems ot be defined in such as way that it returns the path but not the protocol.

 

From the doc page:

SteveHTM_0-1745954061286.png

I guess the use is supposed to be limited to the context of the page compilation system?

 

Hope this helps!

 

Steve

Steve Christian

HTM Solutions

https://info.htmsolutions.biz/meetings/stevec2

mobilePhone
+1 6195183009
emailAddress
stevec@htmsolutions.biz
website
www.htmsolutions.biz
address
San Diego, CA
Create Your Own Free Signature

View solution in original post

BarryGrennan
Solution
Guide

Assets missing protocol using get_asset_url

SOLVE

Yeah, there must be some reasoning behind it.

But you can get around it by using

{{ 'https:' + get_asset_url('../fonts/fa-solid-900.woff2') }}


and maybe to be totally safe

{{ 'https:' + get_asset_url('../fonts/fa-solid-900.woff2')|regex_replace('https?://', '') }}

 


profile2022aBarry Grennan

Freelance HubSpot CMS Developer

Website | Contact | LinkedIn

 

 

 

View solution in original post

3 Replies 3
BarryGrennan
Solution
Guide

Assets missing protocol using get_asset_url

SOLVE

Yeah, there must be some reasoning behind it.

But you can get around it by using

{{ 'https:' + get_asset_url('../fonts/fa-solid-900.woff2') }}


and maybe to be totally safe

{{ 'https:' + get_asset_url('../fonts/fa-solid-900.woff2')|regex_replace('https?://', '') }}

 


profile2022aBarry Grennan

Freelance HubSpot CMS Developer

Website | Contact | LinkedIn

 

 

 

SteveHTM
Solution
Key Advisor | Platinum Partner
Key Advisor | Platinum Partner

Assets missing protocol using get_asset_url

SOLVE

@arcknowledge - strangely - and I don't know why this is the case - the HubL function seems ot be defined in such as way that it returns the path but not the protocol.

 

From the doc page:

SteveHTM_0-1745954061286.png

I guess the use is supposed to be limited to the context of the page compilation system?

 

Hope this helps!

 

Steve

Steve Christian

HTM Solutions

https://info.htmsolutions.biz/meetings/stevec2

mobilePhone
+1 6195183009
emailAddress
stevec@htmsolutions.biz
website
www.htmsolutions.biz
address
San Diego, CA
Create Your Own Free Signature
DianaGomez
Community Manager
Community Manager

Assets missing protocol using get_asset_url

SOLVE

Hi, @arcknowledge 👋 Thanks for reaching out. 

 

Let's invite some community members into the conversation — hey @BarryGrennan  @Anton @LucBenayoun, @SteveHTM  can you share how you are handling this in your current workflow?

 

Thank you very much! 

Diana


HubSpot’s AI-powered customer agent resolves up to 50% of customer queries instantly, with some customers reaching up to 90% resolution rates.
Learn More.


¿Sabías que la Comunidad está disponible en Español?
¡Participa hoy en conversaciones en el idioma de tu preferencia,cambiando el idioma en tus configuarciones!
0 Upvotes