Theme structure (JSON)
The template package format used for templates, imports, exports and AI generation.
A template, an exported theme, an AI-generated theme and a .theme.json import file all use the same package format:
{
"settings": { "color_accent": "#0f766e", "font_heading": "Poppins" },
"templates": {
"index": { "sections": { … }, "order": [ … ] },
"product": { "sections": { … }, "order": [ … ] }
},
"groups": {
"header": { "sections": { … }, "order": [ … ] },
"footer": { "sections": { … }, "order": [ … ] }
},
"sections": { "my-section": { "name": "…", "liquid": "…", "css": "…", "js": "…", "schema": { … } } },
"snippets": { "my-snippet": "<div>…</div>" },
"layout": "<!doctype html>…"
}Only settings, templates and groups are required. sections and snippets hold custom or overridden code; leave them out to use the built-ins. Leave out layout to use the default layout.
Page template / section group#
{
"sections": {
"hero": {
"type": "image-banner",
"settings": { "height": "large", "overlay": 35 },
"blocks": {
"heading_1": { "type": "heading", "settings": { "heading": "New arrivals", "size": "xl" } },
"buttons_1": { "type": "buttons", "settings": { "label_1": "Shop now", "link_1": "/collections/all" } }
},
"block_order": ["heading_1", "buttons_1"]
},
"featured": { "type": "featured-collection", "settings": { "title": "Bestsellers", "limit": 8 } }
},
"order": ["hero", "featured"]
}| Key | Meaning |
|---|---|
sections | Section instances keyed by a unique id (letters, numbers, _, -) |
type | Section type: a built-in name or one of your custom sections |
settings | Values for the section's schema settings (missing ones use the schema default) |
blocks / block_order | Block instances and their order |
disabled | true hides the section without deleting it |
order | The order sections appear on the page |
Built-in section types#
announcement-bar · header · image-banner · slideshow · featured-collection · collection-list · image-with-text · rich-text · multicolumn · testimonials · newsletter · faq · logo-list · video · countdown · featured-product · custom-liquid · contact-form · footer, plus the page-specific main-* sections.
Open any of them in the code editor to see the source. It's the best reference for writing your own.
Layout#
The layout wraps every page. It must output these four variables:
<head>
…
{{ content_for_header }} {%- comment -%} fonts, theme CSS, SEO, app scripts {%- endcomment -%}
</head>
<body class="template-{{ template.name }}">
{% sections 'header-group' %}
<main id="main">{{ content_for_layout }}</main>
{% sections 'footer-group' %}
{{ content_for_footer }} {%- comment -%} cart drawer, theme JS, app widgets {%- endcomment -%}
</body>content_for_header or content_for_footer is missing, the theme CSS, cart drawer, payment scripts and the visual editor stop working.