attachmentUrlΒΆ

This generates a URL pointing to an attachment.

Parameters:

_id
Id to the content holding the attachment.
_path
Path to the content holding the attachment.
_name
Name to the attachment.
_label
Label of the attachment. Default is source.
_download
Set to true if the disposition header should be set to attachment. Default is false.
_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.attachmentUrl({'_download=true'})}">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:attachmentUrl('_download=true')"/>
  </xsl:template>

</xsl:stylesheet>