assetUrlΒΆ

This generates a URL pointing to a static file in the site/assets folder, such as CSS, background images, etc.

Parameters:

_path
Path to the asset.
_application
Use this when the asset referenced is in another application. Defaults to current application. Use the app name, for example, com.enonic.blog.superhero.
_type
URL type. Either server (server-relative URL) or absolute. Default is server.
everything else
Custom parameters to append to the url.

Usage in Thymeleaf:

<a data-th-href="${portal.assetUrl({'_path=css/main.css'})}">Link</a>

Usage in XSLT:

<xsl:stylesheet version="2.0" exclude-result-prefixes="#all"
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  xmlns:portal="urn:enonic:xp:portal:1.0">

  <xsl:template match="/">
    <xsl:value-of select="portal:assetUrl('_path=a')"/>
  </xsl:template>

</xsl:stylesheet>