These docs are for v3.4. Click to read the latest docs for v5.0.

Template Settings

Open Content Template Settings

About Template settings in Open Content

Some times you want a setting for a template, that can be set outside the normal Edit screen.
This can be used to add options to a Template, anything from color variations to a switch to change the rendering of the template layout.
When you add a setting to a template, the user will first be presented with an "Edit Template Settings" screen after choosing a template and before the content can be edited.

You can use all the Field types for Template settings, making Open Content templates even more flexible.

Adding Template settings in Open Content

Template settings can be defined by adding the "mytemplate-schema.json" and "mytemplate-options.json" files (when your template is named mytemplate.hbs / .cshtml)
In these files you define the fields as you would for a regular template, but they will appear as settings.

Using template settings in your Template

You can use settings in your Handlebars templates using @root.Settings.MySetting.
Below is an example of a Template with a list of link, with a Template wide setting to open the links in a new window

{{#each Items}}
<a href="{{Link}}"{{#if @root.Settings.NewWindow}} target="_blank"{{/if}}>{{Text}}</a>
{{/each}}
{
  "type": "object",
  "properties": {
    	"NewWindow": {
			"title": "Open Links in new Window",
			"type":"boolean"
		}
  }
}