Enhancing pages with JSON templates
In Chapter 1, Getting Started with Shopify, while discussing the theme structure, we briefly mentioned JSON templates, but what exactly are they?
The .json
type templates generally have the same purpose as their counterpart .liquid
templates, as they both allow us to create and manage the look of multiple pages through a single template. However, the significant difference between the two is that while the .liquid
type template serves only as a markup file, the .json
file serves as a data type file, which allows us to easily add, remove, or rearrange the sections on any page, similar to what we can do on the home page.
The .json
type templates also share similarities with the Section
directory files, where we need to include a valid schema setting inside the section file. The .json
type template needs to be a valid .json
file, with the JSON code defined inside the template. While we can create any number of .json
type files, the template files...