Templates
Templates are reusable designs with dynamic content areas called variables. Create a template once, then render it with different data to generate unique images.Creating Templates
Visual Editor
The dashboard provides a drag-and-drop editor for creating templates:- Go to Templates in the dashboard
- Click Create Template
- Use the canvas to add text, images, shapes, and backgrounds
- Mark elements as variables by clicking the variable icon
- Save your template
HTML/CSS Import
You can also create templates from HTML/CSS:Variables
Variables are placeholders that get replaced with actual values when rendering. Define variables using double curly braces:{{variableName}}.
Variable Types
| Type | Description | Example |
|---|---|---|
text | Plain text content | {{title}}, {{description}} |
image | Image URL | {{logo}}, {{avatar}} |
color | Hex or RGB color | {{backgroundColor}}, {{textColor}} |
number | Numeric value | {{price}}, {{count}} |
boolean | True/false value | {{showBadge}}, {{isPremium}} |
Variable Definitions
Each variable can have a definition that includes:Getting Template Variables
Retrieve variable definitions before rendering:Rendering Templates
Render a template by providing values for its variables:Template Structure
Templates are stored as FabricJS canvas data with additional metadata:Output Formats
Templates support multiple output formats:| Format | Extension | Use Case |
|---|---|---|
| PNG | .png | Transparent backgrounds, screenshots |
| JPEG | .jpg | Photos, smaller file sizes |
| WebP | .webp | Modern browsers, best compression |
.pdf | Documents, print materials | |
| GIF | .gif | Animated content |
Multi-Page Templates
PDF templates can have multiple pages:Template Categories
Organize templates with categories and tags:- Categories:
og-image,social-media,email,document,marketing - Tags: Custom labels for filtering
Best Practices
- Use descriptive variable names:
authorProfileImageinstead ofimg1 - Set default values: Ensure templates render even with missing data
- Validate input: Use validation rules to catch errors early
- Keep templates focused: One template per use case
- Version templates: Use naming conventions like
og-image-v2