Skip to content

Key Concepts › Templates

Overview

A template is one .jinja file in your theme's templates/ directory. The storefront picks one for every page it serves, gives it the page's data, and returns what it renders.

Where templates live

templates/
├── layout.jinja          required — every page extends it
├── home.jinja            the store's homepage
├── 404.jinja             any address the store does not serve
└── partials/             anything you include; never rendered on its own
    ├── header.jinja
    └── footer.jinja

Names are always resolved from templates/, wherever the tag that names them is written. {% include "partials/header.jinja" %} means the same file inside home.jinja and inside partials/footer.jinja. There is no .., and nothing outside your theme can be named.

How a page chooses its template

RequestTemplate
/home.jinja
Any address the store does not serve404.jinja

More pages join this table as the storefront serves them — products, categories, content pages, search and the cart. Overridable Templates lists every name, and which are served today.

One layout, many pages

Every page template extends layout.jinja and fills its blocks:

{% extends "layout.jinja" %}

{% block content %}
  <h1>{{ store.name }}</h1>
{% endblock %}

The layout owns everything that is the same on every page — the <html> element with its language and direction, the stylesheet, the header and footer — and places the two platform tags. See layout.jinja.

Everything is checked when the theme loads

Every template is compiled when your theme is loaded, not when a shopper first opens the page that uses it. A syntax error, a banned tag or filter, or an include of a file that does not exist is reported with its file and line, and the theme is refused until it is fixed. A theme that loads is a theme in which every template compiles.