Skip to content
Strife Docs

Reference Templates

Defining Templates with JSON

In addition to using the graphical interface in Strife Studio, templates can also be defined using JSON configuration. This allows templates to be stored in source control and automatically synced to Strife as part of your deployment pipeline, depending on your chosen framework and setup.

Note:

Automatic deployment is included when using the Strife Astro integration @strifeapp/astro

Template Properties

PropertyValue
displayName
The name of the template displayed in Strife Studio.
description
A description shown as a hint for editors in Strife Studio.
collection
The RavenDB collection where documents based on this template will be stored.
type
Reserved for C# model binding.
editors
An array defining the fields in the template. See below for details.
normalizedName
A normalized internal name used for reference in Strife Studio.
templateType
Defines the template type: dt (Document Template) or ct (Component Template).
composable
Boolean indicating if content based on this template can be composed inside other documents.
filterable
Boolean indicating if this template should be available as a filter option in Strife Studio.
disable URL
Boolean controlling whether content created from this template should have a public URL.
archived
Boolean indicating if the template is archived.
icon
The icon name used for display in Strife Studio. See Icons for available names.
allowedOrigins
Optional. Normalized names of the templates whose documents may be this template's origin; absent or a non-empty list, never []. Strife Studio's compose dialog and Set origin then offer only those documents; the API does not validate origins against it. Written by defineType's from.
allowedOriginIds
Optional. Ids of specific documents that may be this template's origin, beside or instead of allowedOrigins; absent or a non-empty list, never []. Same Studio-side behaviour, same absence of server-side validation. Written by defineType's from: { id }, where the id is read from an environment variable because it differs per workspace.
baseProperties
{ "displayName": { "localizable": true/false }, "slug": { "localizable": true/false } } — whether the document's name and slug have one value per locale (true) or one shared value (false). Written by defineType's baseProperties, which sends only the flags the type states ({} when none). An unstated or absent flag is the default: slug localizable when the team has two or more locales, displayName not. A template saved without baseProperties keeps the flags it already has; one saved with it stores exactly what it states, and a flag it leaves out goes back to the default. Readers always get strings, resolved to the requested locale.
@metadata
RavenDB metadata and model binding information.
Note:

Note: The @metadata property is required for the template to be accepted by Strife and made available inside Strife Studio.

Field properties

PropertyValue
label
The label shown to editors when editing the field.
description
Optional tooltip text for the field.
editor
The editor type configuration. See example below and check out the fields reference for available types.
localizable
Boolean indicating if the field should be localizable (available only when localization is enabled).

Editor properties

PropertyValue
name
The editor component name.
type
The editor type.
propertyName
The property name used in the RavenDB document.
attributes
Field-specific configuration. See each editor's documentation for supported attributes.
options
Additional options for the editor. See each editor's documentation for supported options.
Note:

You can find specific editor configurations and available options on the respective Field pages.

Example

JSON
{
    "displayName": "Page",
    "description": null,
    "collection": "Pages",
    "type": null,
    "editors": [
        {
            "label": "Sections",
            "description": "",
            "editor": {
                "name": "str-chapters",
                "type": "chapters",
                "propertyName": "sections",
                "attributes": {
                    "hint": "<p>Page sections</p>"
                },
                "options": {
                    "availableTypes": [
                        "text",
                        "content",
                        "hero",
                        "bento"
                    ]
                }
            },
        }
    ],
    "templateType": "dt",
    "normalizedName": "page",
    "disableURL": false,
    "archived": false,
    "icon": "home",
    "hint": "A demo page",
    "searchFields": [],
    "filterFields": [],
    "composable": true,
    "filterable": true,
    "@metadata": {
        "@collection": "Templates",
        "Raven-Clr-Type": "Wieldy.Core.Models.Template, Wieldy.Core"
    }
}