The Template node transforms and formats data from multiple sources into structured text using Jinja2 templating. Use it to combine variables, format outputs, and prepare data for downstream nodes or end users.Documentation Index
Fetch the complete documentation index at: https://docs.dify.ai/llms.txt
Use this file to discover all available pages before exploring further.

Jinja2 Templating
Template nodes use Jinja2 templating syntax to create dynamic content that adapts based on workflow data. This provides programming-like capabilities including loops, conditionals, and filters for sophisticated text generation.Variable Substitution
Reference workflow variables using double curly braces:{{ variable_name }}. You can access nested object properties and array elements using dot notation and bracket syntax.
Conditional Logic
Show different content based on data values using if-else statements:Loops and Iteration
Process arrays and objects with for loops to generate repetitive content:
Data Formatting
Filters
Jinja2 filters transform data during template rendering:Error Handling
Handle missing or invalid data gracefully using default values and conditional checks:Interactive Forms
Templates can generate interactive HTML forms for structured data collection in chat interfaces:
Output Limits
Template output is limited to 80,000 characters (configurable viaTEMPLATE_TRANSFORM_MAX_LENGTH). This prevents memory issues and ensures reasonable processing times for large template outputs.