Skip to main content

Template Tutorial

Learn how to build document templates using Carbone tags and placeholders.

Overview​

The Template Tutorial is an interactive guide built into Compass that teaches you how to create document templates. It explains how Carbone — the document generation engine used by Compass — merges templates with your data to produce finished documents.

How to Access​

  1. In your Compass workspace sidebar, open Documents.
  2. Click Template Tutorial.

Tutorial Sections​

The tutorial is organized into six sections, accessible via a left-side navigation panel:

Getting Started​

Introduces the fundamentals of Carbone templating:

  • What is a template — A document (DOCX, PPTX, ODT, HTML, etc.) containing placeholder tags.
  • What is JSON — The data format Compass uses to populate templates.
  • Carbone Tags — Placeholders written in curly braces that get replaced with data:
    • {d.} — Injects data from the main data object
    • {c.} — Injects data from the complement object
    • {# } — Declares an alias (shortcut)
    • {t( )} — Multi-language translation
    • {o.} — Applies Carbone options
  • Carbone Formatters — Functions added to tags (e.g., :lowerCase) to modify output, including formatting numbers, dates, strings, creating conditions, and performing calculations.

Each concept includes a visual example showing Data → Template → Result.

Nested Data​

Shows how to access sub-objects using dot notation (e.g., {d.type.name}).

Arrays​

Explains how to work with arrays using square bracket notation:

  • {d[0].movie} — Access the first item
  • {d[i=1].movie} — Access the second item

Parent Properties​

Demonstrates accessing parent object properties using double dots (..), for example {d.movie.sub..name} to reach back up the object tree.

Data Formatting​

Covers Carbone formatters in detail:

  • Chaining formatters — e.g., {d.name:lowerCase:ucFirst} to chain multiple transformations.
  • Date formatting — e.g., {d.birthday:formatD(LL)} to display human-readable dates.
  • Constant parameters — Passing fixed values to formatters, with guidance on quoting.
  • Dynamic parameters — Using JSON paths as formatter parameters (absolute with d. or relative with .).

Available Placeholders​

An interactive section where you can:

  • Select a Resource — Choose which module's data to explore (e.g., Projects, Tasks, Budgets).
  • Select a Type — Choose between "Single Item" or "Multiple Items".
  • Browse available fields — View all placeholder fields available for the selected resource and type, ready to use in your templates.

The tutorial page includes a right sidebar that lists all existing Document Templates in your workspace. You can:

  • Search templates by name.
  • Click a template to open it in the template editor.

Related: