asset_url

Returns the CDN URL of the theme's static resources, supporting both absolute and relative paths.

  • Absolute path: The resource to be referenced is at /public/a.js
{{ "a.js" | asset_url() }}
  • Relative path: If the file containing the expression is located at sections/test/two/two.html, and the resource to be referenced is at sections/test/one/test.js
{{ "../one/test.js"| asset_url() }}

filepath | asset_url() returns [string]

Params

  • filepath string: The filepath.

Was this article helpful to you?