Settings
To make it easier for editors to customize your theme, you can use JSON to create settings that editors can access via the Basker Studio.
You can provide settings at the theme, template, or block level. Settings can be fixed (such as informational elements) or interactive (such as a drop-down menu). Setting values can be static, or use dynamic sources to render contextually appropriate values.
Exposing settings makes your theme more customizable so it can better express a venue’s brand. It also can make your theme more flexible so that you can address various use cases for editors.
Location
You can create settings in the following places:
config
> settings.json- Template files in the
templates
folder, using the template’s{% schema %}
tag. - Block files in the
blocks
folder, using the block’s{% schema %}
tag.
Theme settings
The setting.json
file controls the content of the Theme settings area of the theme editor. Settings in this file translate to global theme settings, which can be accessed through the Liquid settings object.
Template settings
The template {% schema %}
tag is where you can create template settings. Those settings can be accessed through the settings attribute of the section object and block object, respectively.
Block settings
The block {% schema %}
tag is where you can create block settings. Those settings can be accessed through the settings attribute of the section object and block object, respectively.
Schema
Settings are defined as a JSON settings attribute that’s parented to the object that the settings apply to. This attribute accepts an array of settings.
Usage
Access settings
Depending on where they were created, you can access settings through the following Liquid objects:
- The global
settings
object - The
template
object - The
block
object