Working with the section schema
In the previous chapter, we learned how to use JSON to create global settings, which has a similar format to the JSON for section files. However, sectional JSON comes with a few distinct differences.
The first major difference is that we need to define JSON inside the section file instead of the settings_schema.json
file. To do this, we will need to introduce the schema
tag:
{% schema %}{% endschema %}
The schema
tag is a Liquid tag that does not have any output on its own. It simply allows us to write JSON code inside the section files. Note that each section file can only contain a single schema
tag, which must stand on its own. It cannot be nested inside any kind of other Liquid tags.
Once we have the schema
tag in place, we are ready to familiarize ourselves with the types of attributes that we can use within the schema
tags.
The name attribute
As its name suggests, the name
attribute allows us to set the section name, which we...