Theme structure
How a hosted Bolder theme is organized: folders, templates, layouts, translations and the files the browser loads.
A hosted theme is a set of files: Liquid templates that render the pages, translations, data, and the CSS, JS, images and fonts the browser loads. This page describes the current structure (v2). The quickest start is bolder new, which creates a minimal theme (the blank theme) with a README describing everything below.
One rule: Liquid goes in the named folders, and anything the browser downloads goes in public/, at the path you want it served from. The theme root only holds theme.yml.
theme.yml name, and `structure: v2`
layouts/default.liquid wraps every page
templates/<page>.liquid one file per kind of page
sections/<name>.liquid blocks placed per page from the theme settings ({% render_sections %})
partials/<name>.liquid reusable snippets: {% include_partial 'name' %}
data/<name>.json|yml data for templates: {{ data.<name> }}
locales/<lang>.json translations: {{ 'titles.cart' | t }}
public/ CSS, JS, images, fonts... in any folders you like
Liquid files use the .liquid extension. File names in layouts/, templates/, locales/ and data/ can’t contain dots, and those folders can’t have subfolders; public/ can be nested as deep as you like.
Pages and their templates
| Page | Template |
|---|---|
Home (/) |
templates/home.liquid |
Product lists (/products, collections, tags, vendors, search) |
templates/products.liquid |
Product (/products/<slug>) |
templates/product.liquid |
Shop pages (/<slug>) |
templates/page.liquid, or templates/page-<slug>.liquid for one page |
| Forms | templates/form.liquid |
| Blog / post | templates/blog.liquid / templates/post.liquid |
Cart (/cart) |
templates/cart.liquid |
| Product comparison | templates/comparison.liquid |
| Not found | templates/404.liquid |
A theme only needs the templates for the pages it has: a page without a template answers 404, rendered with templates/404.liquid (or a plain built-in page inside your layout if the theme has none). The one file every theme needs is layouts/default.liquid.
Layouts
layouts/default.liquid wraps every page. It must print {{ content_for_layout }}, include {% bolder_header 'v2' %} inside <head> and {% bolder_footer 'v2' %} before </body> (they load the cart, checkout and platform scripts).
A page uses the first layout that exists, in this order:
layouts/logged-in.liquid, for logged-in customerslayouts/page-<slug>.liquid(shop pages only)layouts/<page>.liquid, named like the page’s template, e.g.layouts/products.liquidlayouts/default.liquid
Files in public/
Each file is served at its path under public/. Link to it with the public_url filter:
{{ 'css/style.css' | public_url | stylesheet_tag }}
<img src="{{ 'images/home/welcome.png' | public_url }}" alt="">
Inside CSS, use plain relative paths (url(../images/hero.png)). Every public/ URL carries a version that changes whenever any public/ file changes, and relative url()s in CSS get the same one, so browsers and the CDN never serve a stale file.
How a file is stored is decided for you:
- CSS and JS up to 64 KB are editable in the Bolder admin and keep a version history.
- Anything else (images, fonts, minified builds such as
*.min.js, CSS or JS over 64 KB) is stored as an upload: it works the same, and is changed by replacing the file. Uploads can be up to 2 MB (5 MB for videos).
A file that grows past 64 KB becomes an upload when you save it, at the same path; an uploaded CSS or JS file can be turned back into an editable one if it fits. SCSS and LESS are not supported: use plain CSS.
Translations
{{ 'key' | t }} looks the key up in locales/<lang>.json for the shop’s language (nested keys use dots: titles.cart), then in Bolder’s built-in strings. So a theme only needs the keys it adds or changes.
A theme is its files
A theme is exactly the files it contains: what you push is what renders. Installing a theme from the Bolder gallery copies all of its files into the shop’s theme, so there is no master theme to inherit from or override.
Working locally
With the Bolder CLI:
bolder newcreates a theme project from theblankthemebolder devcreates a development copy of the shop’s theme to work on, previewed at/preview/devbolder push,bolder pullandbolder watchsync the project with the theme,public/includedbolder lintchecks the structure, names, sizes andpublic_urlreferences before you pushbolder publishmakes the development theme live
Themes created before v2
Older themes keep all their templates at the root as .html (layout.html, product.html, strings.<lang>.json) and their files in a flat assets/ list. They keep working as they are. A theme is treated as v2 when it has a layouts/ folder.