Skip to content

1. Template Syntax

George Njeri (Swagfin) edited this page Mar 7, 2026 · 1 revision

Template Syntax

Placeholders

Use double curly braces:

{{ PropertyName }}

Examples:

  • {{ Name }}
  • {{ Amount:N2 }}
  • {{ Customer.BankingDetail.BankName }}

Nested Paths

Dot notation is supported:

{{ Customer.CompanyName }}
{{ Customer.BankingDetail.AccountNumber }}

If any intermediate nested object is null, output is empty for that placeholder.

Loops

{{ #foreach(Items) }}
  {{ Name }} x {{ Quantity }}
{{ #endforeach }}

Looping primitive arrays

Use . for the current item:

{{ #foreach(Tags) }}[{{ . }}]{{ #endforeach }}
{{ #foreach(Tags) }}[{{ .:uppercase }}]{{ #endforeach }}

Conditions

{{ #if(Age >= 18) }}Adult{{ #else }}Minor{{ #endif }}

Supported operators:

  • ==
  • !=
  • >
  • >=
  • <
  • <=

Conditions work with numbers, strings, booleans, dates, and collection counts.

Formatting

Standard .NET style formats

  • Number: N2, #,##0
  • DateTime: yyyy-MM-dd, dd-MMM-yyyy hh:mm tt

Examples:

  • {{ Price:N2 }}
  • {{ Price:#,##0 }}
  • {{ PaymentDate:yyyy-MM-dd }}

Built-in string transforms

Format Description
uppercase Uppercase value
lowercase Lowercase value
titlecase Title case value
length Character count
ToMD5 MD5 hash
ToBase64 Base64 encode
FromBase64 Base64 decode

Examples:

  • {{ Name:uppercase }}
  • {{ Value:ToBase64 }}

Unknown Placeholder Behavior

Regular placeholders with unknown property names remain unresolved:

{{ UnknownProperty }}

This helps content authors detect template mistakes quickly.

Clone this wiki locally