Partial Templates¶
Partial templates are reusable HTML snippets stored centrally and referenced by multiple full templates. Common uses: page headers, footers, insurer information blocks, and standard table layouts.
File location¶
All partials live in the common/ subdirectory, shared across all business classes.
Referencing a partial¶
In any full template, include a partial using:
The partial name (e.g. pageHeader) must match the filename without the .html extension.
Partials are rendered in the order they are declared. They have access to the same Handlebars context as the parent template — risk data, clause data, and data capture fields are all available inside a partial.
Registering partials¶
Partial templates must be registered in the database with DocumentTemplateType = PARTIAL. This registration happens automatically when:
- The template file is uploaded from the repository (
uploadSource: DEPLOYMENT) - A corresponding entry exists in the template config JSON
For partials that are shared across business classes, you do not need a separate config entry per business class. One registration covers all uses.
Enabling runtime partial selection¶
By default, the set of partials used by a template is fixed at deployment time. To allow the client microservice to select which partials to use at runtime (e.g. to choose between different header designs based on risk data), enable the following in be_config.json (S3 business config):
When this is enabled, the client microservice can implement DocumentPartialTemplateProvider to return the list of partial names to include for a given risk. This is an advanced pattern — use it when different risks within the same business class genuinely need different document layouts.
Tips¶
- Keep partials focused on one visual component (e.g. just the header, just the insurer block). Avoid combining unrelated content in a single partial.
- Partials can include other partials (nested partials are supported).
- If a partial is updated, all templates that reference it will automatically use the new version after the next deployment.
- Test partial changes by generating a document for a risk that uses the affected template, and visually inspect the output PDF.