Templates
Learn how Masthead renders websites using Liquid templates and how each template contributes to the structure of a theme.
Templates define how a Masthead site is rendered. Every page a visitor sees is generated by one or more Liquid templates contained in the theme.
A Masthead theme contains a small set of core templates that are responsible for rendering pages, posts and the overall layout of the website.
Core templates
Every theme starts with the following templates:
templates/
layout.liquid
index.liquid
page.liquid
post.liquid
not_found.liquid
Each template has a specific responsibility.
Layout
layout.liquid is the outer shell of every page.
It typically contains the HTML document structure, shared navigation, footer and references to your stylesheet. Every other template is rendered inside the layout.
Index
index.liquid is the default homepage of your site.
When a site owner has not selected a custom homepage, Masthead renders this template when visitors open the root of the website.
Many themes use the index page to display a list of recent posts, although it can render any content.
Page
page.liquid renders standard pages.
These are pages created by the site owner using Markdown or HTML. The rendered page content is made available to the template together with the page’s metadata.
Post
post.liquid renders individual posts.
Like pages, posts provide rendered content and metadata to the template, but they also include publication dates, tags and excerpts.
Not found
not_found.liquid is rendered whenever a visitor requests a page that does not exist.
Themes can use this template to provide a custom 404 page that matches the rest of the website.
Theme pages
Besides the core templates, themes can define their own page templates.
These are placed inside the templates/pages directory.
templates/
pages/
home.liquid
pricing.liquid
documentation.liquid
A site owner can select one of these templates when creating or editing a page, allowing themes to provide layouts tailored to specific types of content.
Theme pages can also expose their own configuration, which is covered in the next guides.
Rendering
When a request reaches Masthead, the platform determines which template should be rendered.
For example:
-
The homepage renders
index.liquid, unless a custom homepage has been configured. -
A standard page renders
page.liquid. -
A post renders
post.liquid. -
A theme page renders its corresponding template from
templates/pages. -
Unknown routes render
not_found.liquid.
Regardless of which template is used, the result is always rendered inside layout.liquid.
Next steps
Templates describe the structure of a website, but they become truly configurable through theme tokens and page metadata.
The following guides explain how themes expose configuration to site owners while keeping templates reusable.