This page documents the JSON format for creating custom source templates. For an introduction to using templates, see Source Templates.
A template is a single JSON object. The root-level properties are:
| Property | Required | Default | Description |
|---|---|---|---|
| id | Yes | Unique identifier, becomes the source type (e.g. "uk_1851_census") | |
| title | Yes | Display name shown in the Template drop-down | |
| type | Yes | Fact type code: CENS, BIRT, MARR, DEAT, BAPM, etc. | |
| date | No | Default date for the record | |
| rotated_normally | No | false | Rotate table 90° in reports |
| portrait_in_a4 | No | false | Override rotation for A4 paper |
| portrait_in_b5 | No | false | Override rotation for B5 paper |
| sections | Yes | Array of section definitions |
The sections array is where the template’s layout is defined. Each section has a type that determines its structure.
Label/value pairs, suitable for certificate headers and single-entry data.
Repeating rows, suitable for census households and lists.
Data is stored as {row_prefix}{number}{column_id}, e.g. ROW0_NAME, ROW1_AGE.
Fixed rows with labels, suitable for husband/wife sections on marriage certificates.
Data is stored as {prefix}{column_id}, e.g. HUSB_NAME, WIFE_AGE.
Inline text with embedded fields, suitable for certificate headings and running prose.
A text part has "text" with literal text. Use "\n" for line breaks. A field part has "field" (the field id) and "width". Both text and field parts accept an optional "style": "bold", "italic", or "bold_italic".
These properties apply to entries in the fields, columns, and flow field parts arrays.
| Property | Required | Default | Description |
|---|---|---|---|
| id | Yes | Field identifier (e.g. "_NAME", "_AGE") | |
| label | Yes | Label shown in the entry form | |
| heading | No | Same as label | Heading in report tables (can be more formal) |
| width | No | 10 | Width in characters (entry form) and proportional column width (reports) |
| align | No | "centre" | Text alignment: "left", "centre", "right" |
| height | No | 1 | Height in lines (values greater than 1 create a multi-line field) |
| no_return | No | false | Prevent Enter key in multi-line fields |
| completer | No | Auto-completion helper (see Available completers) | |
| validator | No | Validation helper |
Completers provide auto-suggestions as you type. Assign one to a field with the completer property.
| Name | Suggests |
|---|---|
| census_name | Person names from the database |
| census_place | Places from the place database |
| census_occupation | Historical occupations |
| census_occupation_1911 | Occupations with 1911-era classifications |
| census_relationship | Household relationships (Head, Wife, Son, etc.) |
| census_status | Marital status (Married, Unmarried, Widowed) |
| census_language | Languages (for Welsh/Irish censuses) |
| census_1939_status | 1939 Register status codes |
| gro_districts | GRO registration districts |
| gro_districts_prefixed | GRO districts with volume prefix |
| scottish_districts_prefixed | Scottish registration districts |
| region | English and Welsh regions |
| scottish_region | Scottish regions |
| marriage_venue | Church and chapel names |
| marriage_by | Officiants |
| church_or_chapel | Church or Chapel |
| banns_or_licence | Banns or Licence |
| month | Month names |
| calendar_days | Days 1-31 |
| seven_or_eight | 7d or 8d (registration fees) |
For report tables with grouped columns (common in census templates), use the header_rows property instead of auto-generated headings. This is an array of rows, each containing an array of cells.
Each cell supports:
| Property | Default | Description |
|---|---|---|
| text | Header text (use \n for line breaks) | |
| colspan | 1 | Number of columns this cell spans |
| rowspan | 1 | Number of rows this cell spans |
| align | "centre" | "left", "centre", "right" |
| size | Font size: xx_small, x_small, small, medium, large, x_large, xx_large |
When header_rows is present, the individual column heading values are ignored in favour of the custom header layout.
{
"id": "my_census",
"title": "My Census",
"type": "CENS",
"date": "1 Apr 1801",
"sections": [
{
"type": "table",
"row_prefix": "ROW",
"max_rows": 10,
"columns": [
{ "id": "_NAME", "label": "Name", "width": 15,
"align": "left", "completer": "census_name" },
{ "id": "_AGE", "label": "Age", "width": 4 },
{ "id": "_OCCU", "label": "Occupation", "width": 15,
"completer": "census_occupation" },
{ "id": "_PLACE", "label": "Birthplace", "width": 15,
"completer": "census_place" }
]
}
]
}
This creates a census table with four columns. Each row stores data under keys like ROW0_NAME, ROW0_AGE, ROW1_NAME, and so on.
{
"id": "my_birth_cert",
"title": "Birth Certificate",
"type": "BIRT",
"sections": [
{
"type": "flow",
"parts": [
{ "text": "Births in the District of " },
{ "field": "REG_DIST", "width": 15, "style": "bold" },
{ "text": "\nin the Sub-District of " },
{ "field": "SUB_DIST", "width": 15, "style": "bold" }
]
},
{
"type": "fields",
"borders": "thin",
"fields": [
{ "id": "WHEN_BORN", "label": "When Born", "width": 15 },
{ "id": "WHERE_BORN", "label": "Where Born", "width": 20,
"completer": "census_place" },
{ "id": "NAME", "label": "Name", "width": 20 },
{ "id": "SEX", "label": "Sex", "width": 6 },
{ "id": "FATH_NAME", "label": "Father’s Name",
"width": 20 },
{ "id": "FATH_OCCU", "label": "Father’s Occupation",
"width": 20, "completer": "census_occupation" },
{ "id": "MOTH_NAME", "label": "Mother’s Name",
"width": 20 },
{ "id": "MOTH_MAIDEN", "label": "Mother’s Maiden Name",
"width": 15 }
]
}
]
}
This combines a flow section for the certificate heading (with inline bold fields for district names) and a fields section for the certificate body. The fact type BIRT means Pedigree Forge will automatically set the source’s fact type to Birth.