connect
search

Syntax Limitations

The reference syntax used for templates is a LiquidJS syntax. For more information about the LiquidJS syntax, see the Liquid reference guide.

The reference syntax is parsed to identify all the paths we need to solve with data fetched on-demand from Connect, and has the following limitations:

Output values

For example:

{{entity.name}}

There are no limitations. Output values can have values separated by filters with one or more arguments. For more information on filters, see the Supported Filters section.

For Loop

For example:

{% for item in (valueStart..valueEnd) %}
{{ item }}
{{ item.<property> }}
{% endfor %}
{% for item in collection %}
{{ item }}
{% endfor %}

The following parameters are supported: reversed, offset and limit. For example:

{% for item in collection reversed %}
{% for item in collection reversed offset: argument %}
{% for item in collection reversed limit: argument %}
{% for item in collection offset: argument %}
{% for item in collection offset: argument reversed %}
{% for item in collection limit: argument %}
{% for item in collection limit: argument reversed %}
  • If inside the for body there are reference paths (found as output values, or in assign operations, such as for, if etc) that have not been used outside of it (this is their first appearance), these reference paths will not be solved with data fetched from Connect.
  • Inside the for loop body, the item.<property> is a property that can be accessed only if it exists on that object.

Assign

For example:

{% assign parentAlias = entity.parent %}
{{ parentAlias }}
{{ parentAlias.name }}

The same alias value can be reassigned. Its value will be overwritten, and block scoped/general scoped assignments are not differentiated.

If / Unless

The expression can be:

  • an equality ( == )
  • a non equality ( != )
  • greater than ( > )
  • greater than or equal to ( >= )
  • less than ( > )
  • less than or equal to ( >= )
  • a boolean value.

The boolean value/both expression parts are solved with data fetched from Connect. We can have multiple expressions (comparations) in a if tag using the 'and' and 'or' operators.

For example:

{% if entity.name == 'Awesome Title' %} or {% if entity.name != 'Awesome Title' %} or {% if isAwesome %} or {% if 'Awesome Title' == entity.name %}
This is an awesome title.
{% endif %}
{% if line_item.grams > 20000 and customer_address.city == 'Ottawa' or false %}{% endif %}
{% if entity.attributes['global']['FalseBooleanValue'] %} ... {% endif %}
  • If inside the body of elseif and else branches there are reference paths (found as output values, or in assign operations, such as for, if etc) that have not been used outside of it (this is their first appearance), these reference paths will not be solved with data fetched from Connect.
  • Note that 'contains' is not supported.
{% if customer.tags contains 'VIP' or customer.email contains 'mycompany.com' %}{% endif %}

Case

{% case entity.name %}
{% when 'Instance' %}
Instance!
{% else %}
Not an instance!
{% endcase %}

Only the case expression is parsed, meaning that it will be solved with data fetched from Connect.

If inside the body of when, else branches there are reference paths (found as output values, or in assign operations, for, if etc) that have not been used outside it (this is their first appearance), these reference paths will not be solved with data fetched from Connect.

Supported Filters

Simple filters

  • size

  • compact

  • reverse

  • first

  • last

  • uniq

  • sort

  • sort_natural

  • json *

  • raw

  • escape

  • escape_once

  • url_encode

  • url_decode

  • strip_html

  • newline_to_br

  • capitalize

  • upcase

  • downcase

  • strip

  • lstrip

  • rstrip

  • strip_newlines

  • floor

  • ceil

  • round

  • abs

The json filter is converting values to string as described in the official documentation.

It can be used on a reference that is a primitive (string, number, boolean, Date). For example:
{{entity.createdAt | json}} → This is a Date and will return "2022-04-14T10:08:09.937Z".
{{entity.slug | json}} → This is a string and will return "uptv-apple-season-1-55dfffac".

It can be used on a reference that is an array. For example:
{{entity.tags['Billboard 8:3'].properties.streams | json}} → It will return [object Object],[object Object],[object Object],[object Object].

Limitations for the json filter

It can be used on a reference that is an object, returning only the properties that were queried on that object.

Examples

  1. if
    {{entity.tags['Billboard 8:3'].properties.boundingBox | json}} → Returns { “height”:1080, “width”: 900 }
    then
    {{entity.tags['Billboard 8:3'].properties.boundingBox.height}} → Will return 1080
    {{entity.tags['Billboard 8:3'].properties.boundingBox.width}} → Will return 900
  2. if
    {{entity.tags['Billboard 8:3'].properties.boundingBox | json}} → Returns { “height”:1080 }
    then
    {{entity.tags['Billboard 8:3'].properties.boundingBox.height}} → Will return 1080
  3. if
    {{entity.tags['Billboard 8:3'].properties.boundingBox | json}} → Returns null
    then
    {{entity.tags['Billboard 8:3'].properties.boundingBox.<anysubProperty>}} → this reference is not present in the same text (meaning either in the same _Metadata Template or in the same Package Template →  Deliverable name → Name Format)

Complex filters that support one argument

  • divided_by: argument
  • round: argument
  • plus: argument
  • minus: argument
  • modulo: argument
  • split: argument
  • times: argument
  • prepend: argument
  • append: argument
  • concat: argument
  • join: argument
  • where: argument
  • at_least: argument
  • sort_natural: argument
  • sort: argument
  • truncatewords: argument
  • truncate: argument
  • at_most: argument
  • map: argument
  • default: argument
  • date: argument
  • slice: argument
  • remove: argument
  • remove_first: argument

Complex filters that support two arguments

  • truncatewords: argument1, argument2
  • truncate: argument1, argument2
  • where: argument1, argument2
  • replace: argument1, argument2
  • slice: argument1, argument2
  • replace_first: argument1, argument2

Note that you cannot use filters with dot notation when you need to use the filter inside a tag. For example,
collection.size is not supported. Use collection | size instead.

{% if collection.size > 10 %}
This is not supported!
{% endif %}

Note: Other LiquidJS operations, such as cycle, tablerow, capture, increment, decrement, are not covered.

For more information about LiquidJS operations, see the Tags section of the LiquidJS documentation.

Title

  • entity.tags['TimedTextEN'].<fields> → returns fields on the first file (source file or deliverable file) associated with this tag

  • entity.attributes['en_US']['**Designation1**'].<fields> → returns fields on the first file (source file or deliverable file) associated with this tag

  • File Designation

    • If inside a template exists:

      • entity.attributes['en_US']['Designation'] → returns the file designation id (a tag id)
    • but, If inside a template exists:

      • entity.attributes['en_US'][‘Designation'] → returns the OBJECT representing the file that is tagged with the tag
        AND
      • entity.attributes['en_US'][‘Designation'][‘properties']['format']['duration']
    • returns the properties.format.duration field on the file that is tagged with the tag

  • File

    • If inside a template exists:

      • entity.attributes['en_US'][‘File'] → returns the file id
    • but, If inside a template exists:

      • entity.attributes['en_US'][‘File'] → returns the OBJECT representing the file
        AND
      • entity.attributes['en_US'][‘File'][‘properties']['format']['duration']
    • returns the properties.format.duration field on the file

    • entity.attributes['en_US'][‘File'].id → returns the file id

  • Reference

    • If inside a template exists:

      • entity.attributes['en_US'][‘Reference'] → returns the entity id

      • but, If inside a template exists:

        • entity.attributes['en_US'][‘Reference']
      • returns the OBJECT representing the entity
        AND

      • entity.attributes['en_US'][‘Reference'].attributes['en_US'][‘Attribute_value'] → returns the attributes['en_US'][‘Attribute_value'] on the entity

    • entity.attributes['en_US'][‘Reference'].id → returns the entity id

Package Template → Deliverable name → Name Format

Connect builds the name of the deliverable file as the last element of the path (everything that is after the last “/” in path). As such, the file name cannot contain multiple “/” marks.


Example 1

  • If the name format is example_of_wanted/deliverable/name.jpg, Connect builds the name of the deliverable file as name.jpg.

Example 2

  • If the name format is Tagmime{{entity.tags['Video_deliv_attributes'][‘mimeType']}}_Tag_mime.mov, using the Templates logic it is rendered as Tag_mime_video/quicktime_Tag_mime.mov.
    Connect builds the name of the deliverable file as quicktime_Tag_mime.mov.

General Syntax ValidationsTemplate Troubleshooting