Overview
Template components enable you to:- Reuse templates across multiple HTML and Page operations
- Version templates with semantic versioning for consistency
- A/B test different template versions
- Organize layouts and components separately
- Deploy templates independently from code
- Cache at the edge for fast loading (~0.1ms)
Quick Start
1. Create a Template Component
Create an HTML template file with your preferred template engine:2. Add to Edgit
3. Reference in Your Ensemble
URI Format and Versioning
All template components use the standardized URI format:template://- Protocol identifier for template components{path}- Logical path to the template (e.g.,layouts/main,components/header)[@{version}]- Optional version identifier (defaults to@latest)
@latest- Always uses the most recent version@v1- Uses latest patch of major version (v1.x.x)@v1.0.0- Specific semantic version (immutable)@prod- Custom tag for production versions@staging- Custom tag for staging versions
Example URIs
Template Engines
Templates support multiple rendering engines:Handlebars (Default)
Full featured with helpers, partials, and blocks:Liquid
Django/Jekyll-style templates:Simple
Lightweight variable substitution:MJML
Email templates with responsive design:How to Reference in Ensembles
There are three ways to reference templates in your ensembles:1. URI Format (Recommended)
Use thetemplate:// URI format to reference versioned template components as layouts or partials:
2. Template Expression Format
Use${components.template_name@version} to embed template references:
3. Inline Template
For simple operations or during development, use inline templates directly. Option A: Structured template with engine:Using Templates in Operations
With Partial Components
Page Operation with Template
Email with Template
Layouts and Partials
Layouts
Layouts wrap content with common structure (header, footer, etc.):{{{content}}} variable in the layout receives the rendered template.
Partials
Partials are reusable components included in templates:Caching and Performance
Template components are automatically cached for 1 hour (3600 seconds) after first load.Default Caching
- First load: Fetched from KV (~5-10ms)
- Subsequent loads: Served from edge cache (~0.1ms)
- Cache per version: Each version cached independently
Custom Cache TTL
Bypass Cache
Best Practices
1. Version Your Templates
Use semantic versioning to track changes:2. Use Production Tags
Create stable version tags for production ensembles:3. Organize by Purpose
Use path hierarchies for organization:4. Long Cache for Stable Templates
5. Include Metadata
Add comments to templates for documentation:6. Test Before Promoting
Component Catalog
Conductor includes a catalog of production-ready templates:Deploy Catalog Templates
Versioning Strategy
Development Workflow
Rollback Strategy
Troubleshooting
Template Not Found
Error:Component not found: template://layouts/main@v1.0.0
Solution:
- Check template exists:
edgit list templates - Check version:
edgit versions main-layout - Verify deployment:
edgit status main-layout@v1.0.0
Template Rendering Errors
Issue: Variables not being replaced or syntax errors Solutions:- Check engine matches template syntax (handlebars vs liquid vs simple)
- Verify all required variables are provided in
data - Check template syntax is valid for the chosen engine
- Test template locally before deploying
Partial Not Loading
Issue:{{> template://components/header}} not rendering
Solution: Ensure the partial is:
- Deployed to KV with correct path
- Using correct URI format
- Compatible with the template engine (handlebars supports partials)
Cache Issues
Issue: Updated template not being used Solution: Invalidate cache or setcache.bypass: true

