Template Editor Guide
Build PDF templates with section primitives, dynamic option content, and branding.
The Template Editor (Template Machine) defines how SalesCFG builds final PDFs from configurator selections. You control structure, content behavior, branding, and runtime rules from one place.
Overview
A template is an ordered list of sections. During generation, SalesCFG resolves variables, option-driven content, visibility conditions, and branding, then renders a final document.
Getting Started
New templates open empty and show a starter layout picker. Choose a preset (for example quote/proposal or technical datasheet) or start empty.
- Starter layouts add multiple preconfigured sections at once.
- You can reorder, remove, or retune every inserted section afterward.
- The picker only appears when the section list is empty.
AI Authoring
Template Machine AI creates or edits the same section JSON used by the document engine. AI proposals are staged for review before they are applied, then the normal preview, preflight, save, and PDF generation flow still applies.
Adapt
Adapt uses prompts or reference PDFs as source material for a cleaner template. It may reorganize, summarize, rewrite, merge multiple PDFs, and improve section structure for the selected template type.
Match
Match is available for a single reference PDF. It tries to preserve source order, headings, wording, tables, lists, warnings, notes, image placeholders, and meaningful figures. The engine tracks source coverage and can add repair sections when important PDF blocks were not mapped.
Edit
Edit mode works against the current template using stable section IDs. AI returns patch operations such as update, insert, delete, and move; unchanged sections are kept as-is.
AI may suggest tags only from the selected configurator context. Runtime option matching, visibility rules, placeholders, and final PDF rendering remain deterministic document-engine behavior.
Section Types
Canonical section primitives in the current engine:
| Name | Purpose | Tag behavior |
|---|---|---|
| Cover | Cover page hero, title, subtitle, and intro visual | None |
| Table of Contents | Table of Contents insertion point (auto-built at render time) | None |
| Rich Text | Narrative content, terms, scope, and prose blocks | Option tags |
| Media Block | Standalone image/media block with caption | Option tags |
| Split Layout | Text/image side-by-side composition | Option tags |
| Line Items Table | Configured item table | Option tags |
| Pricing Summary | Totals and pricing summary | Option tags |
| Key Value Grid | Specifications and parameter pairs | Option tags |
| Matrix Table | Comparison matrix | Option tags |
| Data Table | Generic tabular data | Option tags |
| Callouts | Warnings and highlighted notices | Option tags |
| Checklist | Checklist rows and completion blocks | Option tags |
| Milestone List | Milestones/timeline list | Option tags |
| Signatories | Sign-off parties and signatures | Option tags |
| Revision Metadata | Revision, issue date, and validity metadata | Option tags |
| Content Slot | Inserts matching option document content | Content tags |
| Section Group | Structural grouping/chapter wrapper | None |
| Shared Include | Injects a reusable shared content block | None |
TOC is explicit: include a toc section where you want the table of contents to appear. If toc is removed, no TOC is rendered.
Option Tags & Content Tags
Option tags live on options. They make regular template sections appear when the selected option has a matching documentTags value.
Content tags live on option content sections. They tell a content_slot which option-authored content to insert.
In the section inspector, use Show When Option Has Tag on regular sections or Insert Content With Tag on content slots, then control behavior with:
tagMatchMode:anyoralltagEmptyBehavior:show_defaultorhide
Content Slot
content_slot is a dynamic slot primitive for option-driven content expansion. It resolves tagged option sections at generation time and can render placeholders or hide when no match exists.
If you are migrating old templates, content_slot replaces legacy tagged_content.
Variables & Placeholders
Use placeholders inside section text, headers, and footers:
{{key.documentType|Document Name}}
{{key.email|sales@example.com}}
{{customer.name|Valued Customer}}
{{product.name|Configured Product}}Runtime sources include payload fields, template variables, and variable definitions. Use fallback syntax (|fallback) for customer-facing stability.
Conditional Visibility
Any section can define visibleIf rules. Sections are rendered only when their rule set evaluates true in the current generation context.
visibleIf: [
{ field: "total_price", operator: ">", value: 5000 },
{ field: "option_selected", operator: "equals", value: "opt_123" }
]Branding & Layout
Branding controls final document look-and-feel:
- Primary/secondary/accent colors
- Font family
- Logo and cover image
- Header and footer layout/content
- Page size and margins
JSON Import / Export
In the inspector JSON tab, use:
- Import JSON: paste a section array and replace current sections.
- Export JSON: copy the current sections array to clipboard.
Import validates section types against canonical primitives and regenerates section IDs to avoid collisions.
Option Document Sections
Configurator options can define documentSections in admin. Each entry has:
- type (canonical section type)
- tags (for matching)
- config (content payload)
During generation, content slots pull these tagged content sections from selected options.
{
"type": "rich_text",
"tags": ["specs"],
"config": {
"title": "Motor Specifications",
"body": "Power: 7.5 kW\nVoltage: 400V"
}
}Best Practices
- Start from a starter layout, then simplify to your final structure.
- Keep tag names lowercase and consistent (for example: specs, safety, compliance).
- Use fallback placeholders for customer-visible fields.
- Use
tagEmptyBehavior: "hide"for optional runtime-only sections. - Use
section_groupfor layout structure, not content.
FAQ
Do option and template section types need to match?
No for option-tag section visibility, because it does not pull option content. Yes for content_slot output in the sense that inserted content keeps its own original section type.
When should I use content_slot?
Use content_slot when you want slot-style expansion behavior from option-authored content. Use regular typed sections with option tags when you want fixed template-authored content to appear only for selected option tags.
Can I round-trip template sections with JSON?
Yes. Export from the JSON tab, edit externally, then import back. The importer validates and regenerates IDs.
Need help?
See the API Reference for generation payload details and integration endpoints.