Skip to content

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:

└── theme
├── layout
├── templates
| ├── 404.liquid
| ├── event.liquid
| ...
...

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 TypeDescription
404Renders page content that is shown to users if they enter an invalid URL
blogUsed for rendering blog post pages
eventUsed for rendering event pages
organizationUsed for rendering organization pages
pageUsed for rendering page content
personUsed for rendering person pages
postUsed for rendering blog post pages
seasonUsed for rendering season pages
seriesUsed for rendering series pages
venueUsed for rendering venue pages
workUsed for rendering work pages

Schema

Each template must include a schema that defines the fields available for the template.

AttributeTypeRequiredDescription
nameStringYesThe name of the template type
settingsArrayNoA collection of settings that are available for the template.
blocksArrayNoA collection of blocks that are available for the template.

Example

1
{% schema %}
2
{
3
"name": "page",
4
"settings": [],
5
"blocks": [
6
"accordion",
7
"donation-panel",
8
"downloads",
9
"feature-panel",
10
"featured-article",
11
"featured-news",
12
"image-gallery",
13
"membership-levels",
14
"people-panel",
15
"pull-quote",
16
"resource-list",
17
"review",
18
"sponsors",
19
"venue-panel",
20
"video-gallery",
21
"well"
22
]
23
}
24
{% endschema %}

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:

template-name.template-suffix.liquid

For example, if you create an alternat event template with the name of alternate, then the file name would be the following:

event.alternate.liquid

Use an alternate template

After an alternate template has been created, it can be assigned to an associated resource in the Basker Studio.