When to Override Templates
Use template overriding when you need to:- Change the fundamental layout structure
- Add custom Typst functions or packages
- Modify how entries are rendered beyond what
design.templatesallows - Create completely custom designs not achievable through design options
For simpler customizations, try these first:
designfor colors, fonts, spacingdesign.templatesfor changing entry text layout- Arbitrary Keys for adding custom fields to entries
Two Methods
There are two ways to override templates, depending on your needs:Method 1: Quick Customization
Tweak an existing themeβs templates without creating a full custom theme. Best for one-off CVs.
Method 2: Custom Theme
Create a reusable theme with its own design options. Best for multiple CVs or sharing.
Method 1: Quick Template Customization
This method creates template files alongside your CV that RenderCV automatically uses instead of the built-in ones.Modify templates
Edit any template file in the theme folder. For example, to customize the header:
classic/Header.j2.typ
Delete unused templates
Remove any template files you donβt need to customize. RenderCV will automatically fall back to the built-in versions.For example, if you only want to customize the header:
For Existing CVs
If you already have a YAML file and want to add template overrides:classic/ folder for your existing YAML file to use.
Method 2: Create a Custom Theme
This method is better when building a reusable theme with its own design options. See the Custom Themes guide for complete details.Modify templates and design options
- Edit template files to customize the layout
- Optionally edit
__init__.pyto add custom design options
Template Structure
All templates use Jinja2 syntax to generate Typst code:Main Templates
Preamble.j2.typ
Preamble.j2.typ
The document preamble sets up page configuration, colors, fonts, and Typst functions.This is where you:
- Configure page dimensions and margins
- Set colors and fonts
- Import custom Typst packages
- Define reusable Typst functions
Header.j2.typ
Header.j2.typ
Renders the CV header with your name, headline, photo, and connections.
SectionBeginning.j2.typ
SectionBeginning.j2.typ
Renders the section title and opening markup.Variables available:
section_title: The section name (e.g., βExperienceβ)snake_case_section_title: Snake case version (e.g., βwork_experienceβ)entry_type: The entry type (e.g., βExperienceEntryβ)
SectionEnding.j2.typ
SectionEnding.j2.typ
Closes the section.
Entry Templates
Each entry type has its own template in theentries/ subdirectory:
entries/ExperienceEntry.j2.typ
entry variable contains all processed data for the entry, including:
entry.main_column: Rendered left column textentry.date_and_location_column: Rendered right column text
Variables Available in Templates
All templates have access to these variables:| Variable | Type | Description | Example |
|---|---|---|---|
cv | Object | Complete CV data | {{ cv.name }}, {{ cv.sections }} |
design | Object | All design options | {{ design.colors.body.as_rgb() }} |
locale | Object | Locale strings | {{ locale.month_abbreviations }} |
settings | Object | Rendering settings | {{ settings.render_command }} |
entry | Object | Current entry (entry templates only) | {{ entry.company }} |
section_title | String | Section name (section templates only) | {{ section_title }} |
Accessing Design Options
Design options use helper methods for Typst compatibility:Markdown Templates
Both methods also support Markdown template customization:Examples
Example 1: Custom Entry Layout
Modifyentries/ExperienceEntry.j2.typ to add a colored sidebar:
Example 2: Add Icons to Section Titles
ModifySectionBeginning.j2.typ:
Example 3: Custom Photo Shape
ModifyHeader.j2.typ to make the photo circular:
Tips
Start Small
Copy templates and make small changes. Test frequently to catch errors early.
Use --watch Mode
Use
rendercv render --watch to see changes in real-time while editing templates.Keep Backups
Keep a copy of working templates before making major changes.
Delete Unused Templates
Remove templates you donβt customize. RenderCV falls back to built-in versions automatically.
Troubleshooting
Templates not being used
Templates not being used
- Verify the folder name matches your theme (e.g.,
classic/fortheme: classic) - Ensure template files have
.j2.typextension - Check that templates are in the same directory as your YAML file
Jinja2 syntax errors
Jinja2 syntax errors
- Make sure Jinja2 tags are properly closed:
{% if %}...{% endif %} - Check for matching quote types: use
"or'consistently - Validate template syntax with
rendercv renderβit will show Jinja2 errors
Typst compilation errors
Typst compilation errors
- Run
rendercv renderto see Typst error messages - Check Typst function names and arguments
- Verify color/dimension conversion methods:
.as_rgb(),.as_pt(), etc.
Variables not accessible
Variables not accessible
Check the template type:
entryvariable only available in entry templates (entries/*.j2.typ)section_titleonly available inSectionBeginning.j2.typandSectionEnding.j2.typcv,design,locale,settingsavailable in all templates
Next Steps
Custom Themes
Create a reusable theme with custom design options
Arbitrary Keys
Add custom fields to CV entries
Typst Documentation
Learn Typst syntax and functions
Jinja2 Documentation
Master Jinja2 templating