Templates
Templates control what’s rendered on each type of page in a theme.
Each page type has an associated template type. You can use the template to add functionality that makes sense for the page type. For example, to render an event page, the theme needs at least one template of type product.
You can create multiple versions of the same template type to create custom templates for different use cases. For example, you can create a separate event template for special events, or a separate page template for blog posts with video content.
Templates use Liquid with the .liquid
extension.
Location
Template files are located in the templates
directory of the theme:
Types
Each available template type represents a type of content. No template types are required. However, you must have a matching template for any page type that you want to render. For example, to render an event page, you need at least one template of type event
.
You can use the following template types in your theme. To learn more about each template type, click on the template name.
Template Type | Description |
---|---|
404 | Renders page content that is shown to users if they enter an invalid URL |
blog | Used for rendering blog post pages |
event | Used for rendering event pages |
organization | Used for rendering organization pages |
page | Used for rendering page content |
person | Used for rendering person pages |
post | Used for rendering blog post pages |
season | Used for rendering season pages |
series | Used for rendering series pages |
venue | Used for rendering venue pages |
work | Used for rendering work pages |
Schema
Each template must include a schema that defines the fields available for the template.
Attribute | Type | Required | Description |
---|---|---|---|
name | String | Yes | The name of the template type |
settings | Array | No | A collection of settings that are available for the template. |
blocks | Array | No | A collection of blocks that are available for the template. |
Example
Alternative Templates
When working with template files, you should familiarize yourself with alternate templates and how to use them.
Name Structure
Alternate template files use the following name structure, where template-name is the template name, template-suffix is the alternate name:
For example, if you create an alternat event template with the name of alternate, then the file name would be the following:
Use an alternate template
After an alternate template has been created, it can be assigned to an associated resource in the Basker Studio.