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:

NamePurposeTag behavior
CoverCover page hero, title, subtitle, and intro visualNone
Table of ContentsTable of Contents insertion point (auto-built at render time)None
Rich TextNarrative content, terms, scope, and prose blocksOption tags
Media BlockStandalone image/media block with captionOption tags
Split LayoutText/image side-by-side compositionOption tags
Line Items TableConfigured item tableOption tags
Pricing SummaryTotals and pricing summaryOption tags
Key Value GridSpecifications and parameter pairsOption tags
Matrix TableComparison matrixOption tags
Data TableGeneric tabular dataOption tags
CalloutsWarnings and highlighted noticesOption tags
ChecklistChecklist rows and completion blocksOption tags
Milestone ListMilestones/timeline listOption tags
SignatoriesSign-off parties and signaturesOption tags
Revision MetadataRevision, issue date, and validity metadataOption tags
Content SlotInserts matching option document contentContent tags
Section GroupStructural grouping/chapter wrapperNone
Shared IncludeInjects a reusable shared content blockNone

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: any or all
  • tagEmptyBehavior: show_default or hide

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

  1. Start from a starter layout, then simplify to your final structure.
  2. Keep tag names lowercase and consistent (for example: specs, safety, compliance).
  3. Use fallback placeholders for customer-visible fields.
  4. Use tagEmptyBehavior: "hide" for optional runtime-only sections.
  5. Use section_group for 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.

Template Editor Guide | SalesCFG