Managing and Loading Templates

Templates are pre-built designs that make it easier for your users to start modifying and creating their content.

There are two ways you to manage templates in Unlayer. You can either use Unlayer's template manager, or you can save the templates on your servers.

On Unlayer (Easy)

Unlayer provides a template manager where your designers can easily create and modify templates. Each template is given a unique ID which can be used during initialization or any time after that.

Here's an example on how you can do it during initialization by passing a templateId.

Method 1:

  templateId: 1,

Or, you can do it after initialization by calling the following function.

Method 2:

unlayer.loadTemplate(1); // 1 is the templateId

On Your Own Servers (Advanced)

If you want to save the templates on your own servers, that can be easily done. Once you create the template in Unlayer's template manager, switch to the JSON tab to get it's JSON.

After the editor is initialized, you have to pass the template JSON like this:

var template = {...}; // template JSON