How to configure and use template settings | PlayerLands

Wed Oct 06 2021

2 min read

Template settings

Template settings allow you to configure variables that can be changed from the portal instead of from the HTML/CSS file.

Let's take a look at our Arvak Orange template as an example. From the portal under Template settings we can see we are using a variety of template settings. Let's look at the Welcome Title in this case.

This template setting allows you to enter a message that will be displayed on the welcome page of the store.

How to configure a template setting.

Navigate to:

  1. Template editor login.

Login and select the organization and template you want to edit and locate the file named settings.json This file is where all of your settings will live, by default there will be a boolean type setting that acts as an example.

lets re-create the Welcome Title setting by following the below:

[{
"identifier":"myTemplateSetting","displayName":"My Template Setting","type":"boolean","default":true
}, {
"identifier":"welcomeTitle","displayName":"Welcome Title","type":"string","default":"welcome to our store!"
}]

Above we have added a new setting with the following parameters:

identifier - The identifier will allow us to call it from our .njk file. In this example we have named it welcomeTitle.

displayName - The displayName is what our setting will be named from inside the portal. In this example we have named it Welcome Title.

type - The type is what type it will be treated as. This example we have set the type to be textArea giving the user in the portal an input field.

default - The default parameter allows you to set what will be there if the setting is empty. This example we have set the default to welcome to our store!

When configuring settings we have to make sure we follow the correct syntax. If not, the template setting may fail

Using your template setting

Now you have set up your template setting, you now can access it from any page. Follow the below example to access our example setting we have created.

{{templateSettings.welcomeTitle}}

Once you have added your setting to your .njk file, you will then be able to see either your message you've added in the portal or the default we added previously.

types

● string - allows you to enter text into an input field.

● editor - allows you to use a text editor.

● textarea - allows you to use a text area to enter your content.

● boolean - Checkbox for true or false.

That's it! Please take a look at our other knowledge base articles to help you start monetizing your server - Knowledge base.

Thanks for reading!

Tags

store, template, settings, custom, html, css