Write a theme
You can write your own theme to customize the look and feel of your CV. It becomes easy to create themes, switch between them, and share with the community.
The theme must be located in the themes directory in the current working directory. Here is an example of the directory structure:
themes└── <my-theme-name> ├── theme.yaml # Theme metadata (required) ├── index.html # Theme template (required) ├── sample.yml # Demo CV data for screenshots (recommended) └── preview.png # Preview image for the theme library (recommended)Initialize the theme
Section titled “Initialize the theme”You can initialize a new theme with the following command:
cvwonder themes create --name "My Theme"This command creates a new directory in the themes/ folder named after the slug of the theme name (themes/my-theme/ here) and initializes the following files:
theme.yaml— theme metadataindex.html— starter templatesample.yml— minimal demo CV data for screenshot generation
Sample CV data (sample.yml)
Section titled “Sample CV data (sample.yml)”The sample.yml file provides demo CV data used for screenshot generation. It is automatically created when you run themes create and follows the same YAML structure as your main cv.yml.
CVWonder uses this file as the CV source when generating a theme preview, so it should demonstrate the theme’s layout and design well.
person: name: Jane Doe profession: Software Engineer location: Paris, France email: jane.doe@example.com phone: "+1 555 000 0000" experience: since: 2018career: - companyName: Example Corp missions: - position: Senior Engineer company: Example Corp location: Paris, France dates: "2020 - Present" summary: Led development of core platform services. description: - Designed and implemented microservices architecture. - Mentored junior engineers. technologies: - Go - DockerGenerate a preview screenshot
Section titled “Generate a preview screenshot”Generate a preview.png image for your theme using the themes screenshot command:
cvwonder themes screenshot my-themeAliases: themes ss
The screenshot is captured at 1280×900 px with 2× device scale (retina quality), producing a 2560×1800 PNG at themes/my-theme/preview.png.
CV source resolution order:
themes/<theme>/sample.yml— theme-specific demo data (recommended)./cv.yml— the root CV file as fallback- Fatal error if neither is found
Theme metadata
Section titled “Theme metadata”Add a theme.yaml file at the root of the theme directory which contains the theme metadata.
name: My Wonderful Themeslug: my-wonderful-themedescription: A wonderful theme for your CVauthor: Germain| Key | Description |
|---|---|
name |
The name of the theme |
slug |
The slug of the theme. It is used to name your directory in the themes/ folder. |
description |
A short description of the theme |
author |
The author of the theme |
minimumVersion |
The minimum version of cvwonder required to use the theme. |
Theme configuration
Section titled “Theme configuration”Themes can expose a set of configurable options that users can override at generation time. Declare default values in the configuration: block of theme.yaml:
name: My Wonderful Themeslug: my-wonderful-themedescription: A wonderful theme for your CVauthor: Germainconfiguration: displayName: true person: anonymisation: false socialNetworks: display: trueAccessing configuration in templates
Section titled “Accessing configuration in templates”Configuration values are available in the template under the .Config variable:
{{ if index .Config "displayName" }} <h1>{{ .Person.Name }}</h1>{{ end }}
{{ if index .Config "person" }} {{ $person := index .Config "person" }} {{ if index $person "anonymisation" }} <h1>Anonymous</h1> {{ else }} <h1>{{ .Person.Name }}</h1> {{ end }}{{ end }}Overriding configuration at generation time
Section titled “Overriding configuration at generation time”Users can override any configuration value at runtime with the --config flag on the generate or serve commands:
# Override a top-level keycvwonder generate --config "displayName=false"
# Override a nested key using dot-notationcvwonder generate --config "person.anonymisation=true"
# Multiple overridescvwonder generate --config "displayName=true" --config "person.anonymisation=false"Values are automatically coerced: "true" / "false" become booleans, plain integers like "5" become numbers, everything else stays a string.
CLI overrides are deep-merged on top of the defaults declared in theme.yaml: sibling keys are preserved, only the specified leaf is replaced.
Build the theme
Section titled “Build the theme”The templated file is located at themes/<my-theme-name>/index.html and stands as the entry point for the theme.
The templating engine is the template/html go package.
The input CV data is formerly structured to make it easy to use in the template. In order to help you write the data, a JSON Schema is provided in the schema directory.
For example, the dv data contains the details of the CV owner:
[...]
person: name: Germain profession: Bâtisseur de Plateformes et de Nuages experience: years: 10 since: 2014
[...]Which can be used in the template like this:
<h1>{{ .Person.Name }}</h1><h2>{{ .Person.Profession }}</h2>{{ if .Person.Experience.Years }} <p>{{ .Person.Experience.Years }} years of experience</p>{{ end }}{{ if .Person.Experience.Since }} <p>Since {{ .Person.Experience.Since }}</p>{{ end }}Custom fields and custom sections
Section titled “Custom fields and custom sections”Every entity in the CV data model (.Person, .Company, .SocialNetworks, each .Career[] entry and its .Missions[], .TechnicalSkills, each .TechnicalSkills.Domains[] and its .Competencies[], each .SideProjects[], .Certifications[], .Education[], .References[] and .Languages[] entry, and the CV root itself) exposes an optional .Custom field: an ordered list of {Label, Value} entries that authors add by hand in cv.yml for data the model has no dedicated field for.
The CV root also exposes .CustomSections, an ordered list of whole sections the model has no name for at all. Each entry has a Title and its own Fields list, using the same {Label, Value} shape:
person: name: Germain custom: - label: Availability value: Immediate
customSections: - title: Publications fields: - label: Distributed Systems at Scale value: 2023A minimal example that iterates a .Custom list:
{{ range .Person.Custom }} <p>{{ .Label }}: {{ .Value }}</p>{{ end }}And a .CustomSections example:
{{ range .CustomSections }} <h2>{{ .Title }}</h2> {{ range .Fields }} <p>{{ .Label }}: {{ .Value }}</p> {{ end }}{{ end }}Value may be a plain scalar (string, number, boolean), a list, or a nested object — whatever shape the author wrote in YAML, with no type constraint enforced by cvwonder. cvwonder does not provide a helper to detect a value’s shape; themes that only render scalars can simply print {{ .Value }}, and a theme choosing to also support a known list-shaped value is responsible for ranging over it directly with the existing template constructs:
{{ range .Person.Custom }} {{ if eq .Label "Topics" }} <ul> {{ range .Value }}<li>{{ . }}</li>{{ end }} </ul> {{ else }} <p>{{ .Label }}: {{ .Value }}</p> {{ end }}{{ end }}Enable the watch feature
Section titled “Enable the watch feature”To enable the watch feature on CV Wonder, you have to inject an internal js script in the template. This script will automatically reload the page when the CV data or the Theme is updated.
<script src="http://localhost:35729/livereload.js"></script>