STEP 1 Introduction to Jinjava


Introduction


Jinjava is a Java-based template engine, allowing the separation of application logic from its presentation layer. The principle of Jinjava operation consists in placing tags in the content’s source files. The tags are then replaced with content generated by the application. The system allows the use of control structures (tests (if), loops (for), and so on). It comes with an easy-to-use filter system.

Places where you can use jinjava in Synerise platform are:

  • Inserts – used in communication module as a reference to created earlier analytics or AI recommendations. They can be used for example, if you want to personalize your email with the client’s name, adding the value of your client’s last transaction or the number of loyalty points.
  • AI recommendations campaigns with a specific context (for example presenting products from a specific brand),
  • Automation module.

Based on jinjava you are able to create consistent, omnichannel communication. By collecting information about a specific customer, you can create the best customer experience on different channels. All of that - keeping the client’s context (e.g., his last visited pages, bought products, favorite categories) based on which you can create personalized communication with him at every touchpoint.

From this chapter you will learn:

Arrow down iconwhat jinjava is,

Arrow down iconwhere in Synerise you can use jinjava.

Jinjava basics


Watch the videos below to learn the basics of Jinjava. With Jinjava, you can easily create custom templates, filter and manipulate data, and even build your own logic. Check it out and see how it can help you get the most out of Synerise!

Jinjava Basics | Definition, delimiters and variables


Jinjava engine allows you to use delimiters.

Jinjava delimiters are special characters that mark the boundaries of instructions within a template. There are two types of delimiters:

  • Print Delimiters: They use double curly braces ({{ }}) and are used to display dynamic content in the template. Anything inside these delimiters will be evaluated and the result will be shown in the final output.
  • Tag Delimiters: They use curly braces with a percent sign ({% %}) and are used for executing logic and control structures within the template.

You can use also variables, which represent dynamic data that will be rendered when the template is processed. Jinjava supports a wide range of variable types, including strings, numbers, lists, and objects, enabling developers to incorporate various data sources and manipulate them as needed.


Jinjava Basics | Conditional statements and loops


In Jinjava, one of the essential aspects is the utilization of conditional statements and loops. With conditional statements, such as “if” and “else”, developers can add logic to their templates and control the rendering of specific content based on certain conditions. This enables dynamic rendering and the display of different content depending on the data or user input. Additionally, loops, like “for”, provide the ability to iterate over collections or repeat a certain block of code multiple times, allowing for efficient and dynamic rendering of lists or other repetitive elements.


Jinjava Basics | Filters


Another fundamental aspect of Jinjava Basics is the implementation of filters. Filters are functions that can be applied to variables within Jinjava expressions to modify their values or format them in a specific way. For example, filters can be used to convert text to uppercase or lowercase, format dates, truncate strings, or perform mathematical operations. Jinjava provides a wide range of built-in filters, and developers can also create custom filters to suit their specific needs. Filters enhance the flexibility and versatility of Jinjava templates by enabling data transformation and formatting without modifying the underlying data source.


Detailed information:
Jinjava documentation tile illustration
Jinjava documentation
Get to know how to use tags, filters and tests to make your jinjava code more personalized.
Use cases tile illustration
Use cases
Discover our use case base to learn how to use this knowledge in practice.
Certification tile illustration
Certification
Reading those materials you are ready to gain your Jinjava certificate.
😕

We are sorry to hear that

Thank you for helping improve out documentation. If you need help or have any questions, please consider contacting support.

😉

Awesome!

Thank you for helping improve out documentation. If you need help or have any questions, please consider contacting support.

Close modal icon Placeholder alt for modal to satisfy link checker