Templates
Text Formatters, Number Formatters, and Default Values New
You can format text and numbers, and set fallback values directly in your placeholders. This helps you control how data appears in your documents without changing the source data.
Unified Syntax
All modifiers use a pipe (|) separator for easy chaining:
{{property | modifier}}
{{property | modifier:argument}}
{{property | modifier1 | modifier2 | default:'fallback'}}
Text Formatters
Transform text values in your documents.
Uppercase
Convert text to all capital letters.
{{firstname | uppercase}}
Example:
- Input:
john - Output:
JOHN
Lowercase
Convert text to all lowercase letters.
{{lastname | lowercase}}
Example:
- Input:
DOE - Output:
doe
Title Case
Capitalize the first letter of each word.
{{company | titlecase}}
Example:
- Input:
acme corporation - Output:
Acme Corporation
Truncate
Shorten text to a specific number of characters. Adds three dots (...) at the end.
{{description | truncate:100}}
The number after truncate: is the maximum character count.
Example:
- Input:
This is a very long description that goes on and on... - With
truncate:20:This is a very long ...
Number Formatters
Format numeric values as currency, percentages, ordinals, or phone numbers.
Currency
Format a number as currency with proper symbol and thousands separators.
{{amount | currency:USD}}
{{revenue | currency:EUR}}
{{price | currency:GBP}}
The currency code follows the ISO 4217 standard (USD, EUR, GBP, etc.).
Examples:
1500withcurrency:USD→$1,500.001234.56withcurrency:EUR→€1,234.56
Ordinal
Convert a number to its ordinal form (1st, 2nd, 3rd, etc.).
{{position | ordinal}}
{{rank | ordinal}}
Examples:
1→1st2→2nd3→3rd11→11th21→21st
Percent
Format a decimal value as a percentage.
{{rate | percent}}
{{discount | percent}}
Examples:
0.25→25%0.075→7.5%1.5→150%
Phone
Format a phone number for readability.
{{phone | phone}}
{{mobile | phone}}
Examples:
5551234567→(555) 123-4567+14155551234→+1 (415) 555-1234
Image Formatters
Control the dimensions of images from HubSpot file properties in your generated documents.
Width and Height
Set custom dimensions for file properties that contain images.
{{image_property | width:200}}
{{logo_file | height:150}}
{{photo | width:300 | height:200}}
Parameters:
width: Set image width in pixels (10-2000)height: Set image height in pixels (10-2000)
Examples:
{{company_logo | width:250}}- Sets logo width to 250px, height auto-scales{{product_image | width:400 | height:300}}- Sets both width and height{{headshot | height:200}}- Sets height to 200px, width auto-scales
How It Works
- Template Builder: Configure width and height in Step 2 when selecting a file property
- Placeholder Generated: The builder creates
{{property | width:X | height:Y}} - Document Generation: Images are embedded with your specified dimensions
Use Cases
Company Logos
{{company_logo | width:200}}
Ensure all logos appear at a consistent size regardless of source file dimensions.
Product Images
{{product_photo | width:300 | height:300}}
Create uniform image grids in catalogs or product sheets.
Profile Photos
{{contact_photo | height:150}}
Maintain consistent heights for contact profiles while preserving aspect ratio.
Backward Compatibility
Templates created before this feature continue working without changes:
- Old templates use database-stored dimensions (if configured)
- New templates use placeholder syntax for dimensions
- You can mix both approaches in the same organization
Default Values
Set a fallback value when a property is empty or missing. Use the pipe symbol followed by default:.
Using Fixed Text
Put your fallback text in quotes (single or double).
{{phone | default:'N/A'}}
{{email | default:"Not provided"}}
Example:
- If
phoneis empty: ShowsN/A - If
phonehas a value: Shows the phone number
Using Another Property
Reference a different property as the fallback (no quotes needed).
{{company | default:firstname}}
Example:
- If
companyis empty butfirstnameisJohn: ShowsJohn - If both are empty: Shows nothing
Chaining Multiple Modifiers
You can combine multiple modifiers using pipes. They are applied in order from left to right.
{{name | uppercase | truncate:50 | default:'UNKNOWN CUSTOMER'}}
How it works (left to right):
uppercaseis applied to the value ofnametruncate:50shortens the result if neededdefault:'UNKNOWN CUSTOMER'provides a fallback if the value is empty at any point
Examples:
nameisjohn doe: Result isJOHN DOEnameis empty: Result isUNKNOWN CUSTOMER
{{revenue | currency:USD | default:'$0.00'}}
Syntax Options
New Unified Pipe Syntax (Recommended)
{{firstname | uppercase}}
{{phone | default:'N/A'}}
{{amount | currency:EUR}}
{{text | uppercase | truncate:100}}
Legacy Colon Syntax (Still Supported)
For backward compatibility, the older colon syntax still works for text formatters:
{{firstname:uppercase}}
{{description:truncate:100}}
Both syntaxes can be mixed:
{{name:uppercase | default:'N/A'}}
Common Use Cases
Business Documents
Format company names consistently:
{{company | titlecase | default:'Individual Customer'}}
Contact Information
Handle missing phone numbers with formatting:
{{phone | phone | default:'No phone on file'}}
Financial Documents
Display amounts as currency:
Total: {{amount | currency:USD}}
Discount: {{discount_rate | percent}}
Rankings and Positions
Show ordinal numbers:
{{position | ordinal}} Place Winner
Labels and Shipping
Ensure uppercase for postal addresses:
{{city | uppercase}}, {{state | uppercase}} {{zip}}
Product Descriptions
Keep descriptions to a readable length:
{{product_description | truncate:150}}
Frequently Asked Questions
Q: What happens if I use an unknown formatter? A: Unknown formatters are ignored. Your text appears unchanged.
Q: Can I use multiple formatters?
A: Yes! Chain them with pipes: {{name | uppercase | truncate:50}}
Q: Does the formatter apply to the default value too? A: Yes. When using both formatter and default, the formatter applies to whichever value is used (the original or the default).
Q: Can I use formatters with QR codes or barcodes?
A: QR codes and barcodes have their own modifiers (size and format). Text/number formatters don't apply to them, but you can use the pipe syntax for size: {{qr:property | size:200}}
Q: Can I use text formatters on file properties?
A: No. File properties only support width and height formatters for controlling image dimensions. Text/number formatters are ignored for file properties.
Q: How does currency formatting handle different locales? A: The currency symbol position and number formatting (commas vs. periods) are determined by your organization's locale settings.
Q: Can I format a number that's stored as text? A: Yes, the number formatters will attempt to parse text values as numbers. Values like "1500" or "1,500" will be recognized.