Template Editor Guide
Everything you need to know about building document templates in SalesCFG β from basic sections to dynamic tag-bound content that pulls data from your configurator options.
Overview
The Template Editor (also called the "Template Machine") lets you design PDF document templates for your configurators. Each template is a list of sections that compose a full document β cover page, pricing table, technical specs, signature block, and so on.
When a customer (or sales rep) generates a document from the configurator, the system takes the template, fills it with the selected options and customer data, and renders a branded PDF.
Core Concepts
- Section β a single block in the template (text, image, table, pricing, etc.).
- Tag binding β a section can have
config.tagsthat link it to option content at generation time. - Variable β a placeholder like
{{customer_name}}that gets replaced with real data. - Branding β colors, fonts, logo, and page layout that apply to the whole document.
- Visibility rules β conditions that show or hide sections based on the configuration.
Section Types
The editor supports over 20 section types. Here are the most commonly used:
| Type | Purpose | Supports tag binding? |
|---|---|---|
| Cover | Full-page cover with title, subtitle, logo, background color | β |
| Summary | Introductory text / executive summary | β |
| Text | Free-form text content (title + body) | Yes |
| Image | Single image with optional caption | Yes |
| Items Table | Table of configured items with columns | β |
| Pricing | Pricing summary with totals | β |
| Specs Table | Key-value specification rows | Yes |
| Certifications | Certification list with cert numbers | Yes |
| Safety Warnings | Warning blocks (danger/caution/notice) | Yes |
| Checklist | Checkbox-style checklist items | Yes |
| Two Column | Side-by-side left/right content | Yes |
| Comparison Table | Feature comparison across models | Yes |
| Parameters Block | Grouped parameter sets | Yes |
| Lead Time | Delivery schedule information | β |
| Timeline | Project milestone timeline | β |
| Validity | Quote validity, prepared by, revision | β |
| Signature Block | Signature parties with date fields | β |
| Discount Schedule | Tiered discount table | β |
| Revision History | Document revision log | β |
Tag Binding
Tag binding is the core mechanism that makes templates dynamic. Instead of creating a generic "tagged content slot", you create a real section (text, image, certifications, etc.) and attach tags to it. At generation time, the system finds matching content from the selected options and binds it into that section.
This means you always control the layout β you know exactly what type of content goes where, and you can provide default/fallback content for when no options match.
How It Works
- Add a section to your template (e.g., a
textsection titled "Technical Specifications"). - In the Tag Binding panel, add one or more content tags (e.g.,
specs). - In your configurator options, add
documentSectionsof the same type (text) tagged withspecs. - At generation time, the resolver finds all selected options with matching
textsections taggedspecsand binds their content into the template section.
// Template section (in the editor)
{
type: "text",
config: {
title: "Technical Specifications",
body: "No specs available for this configuration.",
tags: ["specs"],
tagRepeat: "merge",
tagEmptyBehavior: "show_default"
}
}
// Option documentSection (on each configurator option)
{
type: "text", // β must match the template section type
tags: ["specs"], // β must match the template section tags
config: {
title: "Pump Specifications",
body: "Flow rate: 100 L/min\nPressure: 6 bar"
}
}Repeat Modes
When multiple selected options have matching content, the repeat mode controls how they are assembled:
| Mode | Behavior | Best for |
|---|---|---|
| First | Uses only the first matching option's content. | Primary product info, single image |
| Merge | Merges all matches into one section. For text: concatenates bodies. For other types: uses first match. | Safety warnings, specs from multiple components |
| Repeat | Duplicates the section for each match, creating multiple instances in the document. | Certification cards, individual drawings |
Empty Behavior
When no selected options have matching content:
- Show default β renders the section with its own config (the title/body you wrote in the editor). Good for sections that should always appear.
- Hide β removes the section entirely from the generated document. Good for sections that only make sense with option content.
Legacy: Tagged Content Slot
Older templates may use a special tagged_content section type. This is a slot that expands into multiple sections at generation time β the option content replaces the slot entirely.
This still works for backwards compatibility, but we recommend converting to type-bound tag binding instead:
- Replace
tagged_contentwith a real section type (text,image, etc.). - Move
config.tagsto the new section. - Set
tagRepeattomerge(replacestagMergeMode: merge_by_type) orrepeat(replacestagMergeMode: individual). - Add fallback content in the section body for when no options match.
Variables & Placeholders
Template variables let you insert dynamic text anywhere in the document. Use double curly braces:
{{customer_name}} β value from variables
{{customer_name|John Doe}} β with fallback if empty
{{product.name}} β nested path from payload
{{pricing.total}} β pricing dataVariables are defined in the template's variable definitions panel. When generating a document, values come from:
- The
variablesmap in the template JSON. - The
variableDefinitionsarray (overrides the map). - The generation payload (product, selections, pricing data).
Tip: Always use the pipe syntax {{variable|fallback}} for customer-facing fields. This way, documents generated without customer data still look clean.
Conditional Visibility
Any section can have visibility rules that control whether it appears based on the configuration:
visibleIf: [
{ field: "total_price", operator: ">", value: 5000 },
{ field: "option_selected.installation", operator: "is_true" }
]All conditions must be true for the section to appear (AND logic). Available operators:
=,!=,>,>=,<,<=β standard comparisonscontains,in,not_inβ list membershipoption_selectedβ checks if an option is in the selectionexists,is_true,is_falseβ presence and boolean checks
Branding & Layout
The branding panel controls the global look of generated documents:
- Logo β uploaded image shown on the cover page and optionally in headers.
- Cover image β background image for the cover section.
- Colors β primary, secondary, and accent colors used for headings, tables, and accents.
- Font family β applied to all document text.
- Page size β A4 or Letter.
- Page margin β margin in millimeters.
Option Document Sections
Each configurator option can have documentSections β content blocks that get pulled into the template via tag binding. Each document section has:
- Type β must match the template section type (
text,image,certifications, etc.) - Tags β used to match against template section tags (e.g.,
specs,safety) - Config β the content payload (title, body, imageUrl, items, etc.)
Options also have documentTags β a fallback list of tags. If a document section has no tags of its own, the system uses the option-level documentTags instead.
// Example option with document sections
{
label: "Electric Heater 24kW",
price: 4500,
documentTags: ["specs", "safety"],
documentSections: [
{
type: "text",
tags: ["specs"],
config: {
title: "Heater Specifications",
body: "Power: 24 kW\nVoltage: 400V 3-phase"
}
},
{
type: "text",
tags: ["safety"],
config: {
title: "Heater Safety",
body: "Warning: Surface temperature exceeds 80Β°C."
}
}
]
}Best Practices
- Use real section types, not tagged content slots. A
textsection withtags: ["specs"]is always better than atagged_contentslot because you control the layout, see a preview, and have fallback content. - Match types between template and options. If your template has an
imagesection taggeddrawings, your options must provideimagedocument sections taggeddrawingsβ nottext. - Use pipe fallbacks for variables. Write
{{customer_name|Valued Customer}}instead of{{customer_name}}so documents always look complete. - Keep tag names consistent. Use simple lowercase tag names like
specs,safety,overview,compliance,service. The Tag Library panel shows all tags in use. - Use "hide" for optional sections. Set
tagEmptyBehavior: "hide"for sections that only make sense when options provide content (safety warnings, compliance notes). - Use "show default" for always-present sections. Sections like "Technical Specifications" should show fallback content even when no matching options are selected.
- Set page breaks intentionally. Use
pageBehavior: "new_page"for major sections (cover, specs, pricing) andcontinuefor sections that flow naturally.
FAQ
What happens if I tag an image section but options provide text?
Nothing β tag binding requires type matching. An image section only pulls from image document sections. If no images match, the section either shows its default content or is hidden (based on your empty behavior setting).
Can I use the same tag on multiple template sections?
Yes. You might have both a text section and an image section both tagged specs. Each will pull only its matching type from the options.
How do I migrate from tagged_content to type-bound sections?
Replace the tagged_content section with the appropriate real type (usually text). Copy the tags from the old config. Set tagRepeat to merge (was merge_by_type) or repeat (was individual). Add a fallback body.
Do I need to restart the server after editing a template?
No. Templates are stored in the document generator service and loaded fresh for each generation. Save your template and generate immediately.
Need help?
Reach out to the SalesCFG team or check the API Reference for programmatic template management.