Tags for Assets

Linking to Assets

HTML - Stylesheets:

<link rel="stylesheet" type="text/css" href="{{ 'css/styles.css' | asset_url }}" />

=>

https://cdn.staging.oregon.platform-os.com/instances/xxxxxx/assets/css/styles.css?updated=1733383736255

HTML - JavaScript files:

<script src="{{ 'js/myfile.js' | asset_url }}"></script>

=>

https://cdn.staging.oregon.platform-os.com/instances/xxxxxx/assets/js/myfile.js?updated=1733383736255

HTML - Images:

{{ 'images/SG-Logo-White.svg' | asset_url }}

=>

https://cdn.staging.oregon.platform-os.com/instances/xxxxxx/assets/images/SG-Logo-White.svg?updated=1733383736255

If you're on one of our new Cloudflare Oracle Stacks, (Currently only London is available) we strongly recommend using the new image transformations feature instead: About

WebApp Asset Field:

After uploading an image to a WebApp file/image field using the Siteglide Admin's file manager, or using a front-end form, the actual value stored in the database will be something like the format: images/hero/hero01.jpg which will point to a file at the location: marketplace_builder/assets/images/hero/hero01.jpg.

=>

https://cdn.staging.oregon.platform-os.com/instances/xxxxxx/assets/images/hero/hero01.jpg?updated=1733383736255

CSS - Relative Paths:

background-image: url('../images/SG-Logo-White.svg');

Background Images

The easiest way to add CSS background images reliably is actually with an inline style attribute in HTML. This is because it allows you to use the asset_url Liquid filter:

Liquid

Which renders to:

CSS

Other background property rules can be added as normal in CSS.

Last updated

Was this helpful?