Liquid Playground

The Liquid Field Manipulator is specific to running in ImpulseSync, so there may be times where an external Liquid playground will not work to test the Liquid template needed. However, when viewing the configuration for a Liquid Field Manipulator you can access the ImpulseSync Liquid playground.

Using the ImpulseSync Liquid playground

First start by configuring or viewing the configuration for a Liquid Field Manipulator. Then press the "Test Liquid Template" button below the "Fieldvalue" config option.

This will open the ImpulseSync Liquid playground.

From here you can add a template and data to test the template against.

Once the template and data have been added press the "Test Liquid Config" to test the template using the input data. The result will be displayed on the right in the JSON viewer.

Not all Liquid tags and filters are supported in the Liquid playground. i.e., tags to retrieve additional ImpulseSync Content objects, like categories or domains, or the getStoredValue filter.

Inputting Data

The data to input is a JSON object with the following structure.

[
 {
  "contentId": <string value (optional)>
  "langauge": <string value (optional)>
  "fields": [
   {
    "fieldId": <string value>
    "fieldType": <string value of Motation field types (optional)>
    "fieldValue": <string value OR array of string values OR Motation field value in debug report>
   }
  ] 
 }
]

Content ID

The contentId attribute is optional. When it's not set the ID will be a combination of "test-content-id" and the language attribute.

Language

The language attribute is optional. If no language value is set, then no langauge value should be used in the Liquid template to reference fields. Akin to when a system does not support languages for content.

Fields

The fields attribute is an array of field objects. This is the data to be referenced in the Liquid template.

Field ID

The fieldId attribute is the name of the field to be used to reference the field in the Liquid template.

Field Type

The fieldType attribute is optional. If the fieldValue attribute is a string or an string array then the fieldType will be "String" or "Array" respectively.

If the fieldValue attribute is a Motation field value object, then the fieldType attribute can be set to any Motation field type. If it is not set, it will default to "String".

Field Value

The fieldValue attribute is the value of the field. It can have one of the value types.

  1. string value

  2. array of string values

  3. Motation field value

    • Debug report uses Motation field values

The debug report's array of content objects at each step can be copied and pasted as the data value. Allowing for a Liquid template to be tested against the value from the debug report.

Examples

Single value

[
    {
        "language": "en",
        "fields": [
            {
                "fieldId": "title",
                "fieldValue": "my content's title"
            }
        ]
    }
]

Array of fields

[
    {
        "language": "en",
        "fields": [
            {
                "fieldId": "title",
                "fieldValue": "my content's title"
            }, 
            {
                "fieldId": "body",
                "fieldValue": "my content's body field. \n some additional things are here"
            },
            {
                "fieldId": "number",
                "fieldValue": "7.5"
            }
        ]
    }
]

Multiple string values in single field

[
    {
        "language": "en",
        "fields": [
            {
                "fieldId": "title",
                "fieldValue": [
                    "first title value", 
                    "second title value", 
                    "third title value"
                ]
            }
        ]
    }
]

Motation Field Value (Debug Report)

[
    {
        "contentId": "entry::756f1T59Bb0LT584f9FSKF"
        "language": "en",
        "fields": [
            {
                "fieldId": "title",
                "fieldValue": [
                    {
                        "binary": {},
                        "order": 0,
                        "relations": {},
                        "value": "Benchmark Test - test"
                    }
                ]
            }
        ]
    }
]

Last updated