@zohofinance/commerce 1.0.0 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +59 -0
- package/package.json +2 -2
- package/ts-dist/mocks/init-theme/.claude/CLAUDE.md +6 -0
- package/ts-dist/mocks/init-theme/.claude/skills/.archive/zcommerce-section-from-design.20260528/SKILL.md +242 -0
- package/ts-dist/mocks/init-theme/.claude/skills/.archive/zcommerce-section-from-design.20260528/inputs/figma.md +81 -0
- package/ts-dist/mocks/init-theme/.claude/skills/.archive/zcommerce-section-from-design.20260528/inputs/screenshot.md +54 -0
- package/ts-dist/mocks/init-theme/.claude/skills/.archive/zcommerce-section-from-design.20260528/inputs/url.md +88 -0
- package/ts-dist/mocks/init-theme/.claude/skills/.archive/zcommerce-section-from-design.20260528/spec-table.md +102 -0
- package/ts-dist/mocks/init-theme/.claude/skills/.archive/zcommerce-section-from-design.20260528/verification/accessibility.md +110 -0
- package/ts-dist/mocks/init-theme/.claude/skills/.archive/zcommerce-section-from-design.20260528/verification/performance.md +127 -0
- package/ts-dist/mocks/init-theme/.claude/skills/.archive/zcommerce-section-from-design.20260528/verification/tokens.md +87 -0
- package/ts-dist/mocks/init-theme/.claude/skills/.archive/zcommerce-section-from-design.20260528/verification/visual-diff.md +123 -0
- package/ts-dist/mocks/init-theme/.claude/skills/.archive/zcommerce-theme-builder.20260528/SKILL.md +605 -0
- package/ts-dist/mocks/init-theme/.claude/skills/.archive/zcommerce-theme-builder.20260528/design-tokens.md +105 -0
- package/ts-dist/mocks/init-theme/.claude/skills/.archive/zcommerce-theme-builder.20260528/page-json-contract.md +58 -0
- package/ts-dist/mocks/init-theme/.claude/skills/.archive/zcommerce-theme-builder.20260528/qa-accessibility.md +35 -0
- package/ts-dist/mocks/init-theme/.claude/skills/.archive/zcommerce-theme-builder.20260528/reference-lookup.md +94 -0
- package/ts-dist/mocks/init-theme/.claude/skills/.archive/zcommerce-theme-builder.20260528/section-anatomy.md +109 -0
- package/ts-dist/mocks/init-theme/.claude/skills/theme-from-figma/SKILL.md +313 -0
- package/ts-dist/mocks/init-theme/.claude/skills/theme-from-figma/agent-hierarchy.md +142 -0
- package/ts-dist/mocks/init-theme/.claude/skills/theme-from-figma/ask-developer.md +113 -0
- package/ts-dist/mocks/init-theme/.claude/skills/theme-from-figma/bootstrap.md +260 -0
- package/ts-dist/mocks/init-theme/.claude/skills/theme-from-figma/build-metrics.md +89 -0
- package/ts-dist/mocks/init-theme/.claude/skills/theme-from-figma/code-quality.md +186 -0
- package/ts-dist/mocks/init-theme/.claude/skills/theme-from-figma/common-pages-agent.md +97 -0
- package/ts-dist/mocks/init-theme/.claude/skills/theme-from-figma/dev-server-and-urls.md +136 -0
- package/ts-dist/mocks/init-theme/.claude/skills/theme-from-figma/exemplars.md +79 -0
- package/ts-dist/mocks/init-theme/.claude/skills/theme-from-figma/figma-discovery.md +138 -0
- package/ts-dist/mocks/init-theme/.claude/skills/theme-from-figma/figma-extraction.md +132 -0
- package/ts-dist/mocks/init-theme/.claude/skills/theme-from-figma/image-sources.md +84 -0
- package/ts-dist/mocks/init-theme/.claude/skills/theme-from-figma/inputs/guidelines-frame.md +178 -0
- package/ts-dist/mocks/init-theme/.claude/skills/theme-from-figma/page-builder.md +322 -0
- package/ts-dist/mocks/init-theme/.claude/skills/theme-from-figma/page-orchestrator.md +199 -0
- package/ts-dist/mocks/init-theme/.claude/skills/theme-from-figma/parallel-fanout.md +152 -0
- package/ts-dist/mocks/init-theme/.claude/skills/theme-from-figma/scripts/a11y.mjs +129 -0
- package/ts-dist/mocks/init-theme/.claude/skills/theme-from-figma/scripts/lint-section.mjs +502 -0
- package/ts-dist/mocks/init-theme/.claude/skills/theme-from-figma/scripts/perf.mjs +134 -0
- package/ts-dist/mocks/init-theme/.claude/skills/theme-from-figma/scripts/pixel-diff.mjs +206 -0
- package/ts-dist/mocks/init-theme/.claude/skills/theme-from-figma/scripts/record-build-metrics.mjs +118 -0
- package/ts-dist/mocks/init-theme/.claude/skills/theme-from-figma/section-builder.md +131 -0
- package/ts-dist/mocks/init-theme/.claude/skills/theme-from-figma/subagent-escalation.md +75 -0
- package/ts-dist/mocks/init-theme/.claude/skills/theme-from-figma/transcription-rules.md +98 -0
- package/ts-dist/mocks/init-theme/.claude/skills/theme-from-figma/verification.md +227 -0
- package/ts-dist/mocks/init-theme/.claude/skills/theme-from-figma/visual-verify-loop.md +117 -0
- package/ts-dist/mocks/init-theme/.claude/skills/theme-from-figma/zcommerce-docs/_index.md +4 -0
- package/ts-dist/mocks/init-theme/.claude/skills/theme-from-figma/zcommerce-docs/assets.md +105 -0
- package/ts-dist/mocks/init-theme/.claude/skills/theme-from-figma/zcommerce-docs/best-practices.md +212 -0
- package/ts-dist/mocks/init-theme/.claude/skills/theme-from-figma/zcommerce-docs/custom-scripts.md +294 -0
- package/ts-dist/mocks/init-theme/.claude/skills/theme-from-figma/zcommerce-docs/i18n.md +155 -0
- package/ts-dist/mocks/init-theme/.claude/skills/theme-from-figma/zcommerce-docs/introduction.md +91 -0
- package/ts-dist/mocks/init-theme/.claude/skills/theme-from-figma/zcommerce-docs/layouts.md +158 -0
- package/ts-dist/mocks/init-theme/.claude/skills/theme-from-figma/zcommerce-docs/pages.md +156 -0
- package/ts-dist/mocks/init-theme/.claude/skills/theme-from-figma/zcommerce-docs/reference/_index.md +4 -0
- package/ts-dist/mocks/init-theme/.claude/skills/theme-from-figma/zcommerce-docs/reference/filters.md +419 -0
- package/ts-dist/mocks/init-theme/.claude/skills/theme-from-figma/zcommerce-docs/reference/global-objects.md +415 -0
- package/ts-dist/mocks/init-theme/.claude/skills/theme-from-figma/zcommerce-docs/reference/schema-types.md +926 -0
- package/ts-dist/mocks/init-theme/.claude/skills/theme-from-figma/zcommerce-docs/reference/tags.md +259 -0
- package/ts-dist/mocks/init-theme/.claude/skills/theme-from-figma/zcommerce-docs/sections.md +203 -0
- package/ts-dist/mocks/init-theme/.claude/skills/theme-from-figma/zcommerce-docs/setup-guide.md +424 -0
- package/ts-dist/mocks/init-theme/.claude/skills/theme-from-figma/zcommerce-docs/snippets.md +70 -0
- package/ts-dist/mocks/init-theme/.claude/skills/theme-from-figma/zcommerce-docs/theme-structure.md +252 -0
- package/ts-dist/mocks/init-theme/.cursor/PLAYBOOK.md +144 -0
- package/ts-dist/mocks/init-theme/.cursor/README.md +6 -0
- package/ts-dist/mocks/init-theme/.cursor/agents/figma-desktop-mobile-parallel.md +48 -0
- package/ts-dist/mocks/init-theme/.cursor/agents/visual-compare.md +221 -0
- package/ts-dist/mocks/init-theme/.cursor/commands/add-field.md +83 -0
- package/ts-dist/mocks/init-theme/.cursor/commands/add-theme-setting.md +200 -0
- package/ts-dist/mocks/init-theme/.cursor/commands/assemble-page.md +72 -0
- package/ts-dist/mocks/init-theme/.cursor/commands/audit-page.md +57 -0
- package/ts-dist/mocks/init-theme/.cursor/commands/build-page-sections.md +110 -0
- package/ts-dist/mocks/init-theme/.cursor/commands/build-section.md +418 -0
- package/ts-dist/mocks/init-theme/.cursor/commands/build-theme.md +307 -0
- package/ts-dist/mocks/init-theme/.cursor/commands/compare-section.md +358 -0
- package/ts-dist/mocks/init-theme/.cursor/commands/create-theme.md +77 -0
- package/ts-dist/mocks/init-theme/.cursor/commands/extract-tokens.md +43 -0
- package/ts-dist/mocks/init-theme/.cursor/commands/fix-section.md +92 -0
- package/ts-dist/mocks/init-theme/.cursor/commands/impact.md +50 -0
- package/ts-dist/mocks/init-theme/.cursor/commands/qa-a11y.md +66 -0
- package/ts-dist/mocks/init-theme/.cursor/commands/qa-i18n.md +110 -0
- package/ts-dist/mocks/init-theme/.cursor/commands/qa-layout.md +127 -0
- package/ts-dist/mocks/init-theme/.cursor/commands/qa-performance.md +72 -0
- package/ts-dist/mocks/init-theme/.cursor/commands/qa-section.md +84 -0
- package/ts-dist/mocks/init-theme/.cursor/commands/qa-sections.md +48 -0
- package/ts-dist/mocks/init-theme/.cursor/commands/qa-theme.md +85 -0
- package/ts-dist/mocks/init-theme/.cursor/commands/redesign-section.md +177 -0
- package/ts-dist/mocks/init-theme/.cursor/commands/refactor-section.md +185 -0
- package/ts-dist/mocks/init-theme/.cursor/commands/sync-theme-settings.md +132 -0
- package/ts-dist/mocks/init-theme/.cursor/commands/validate-page.md +60 -0
- package/ts-dist/mocks/init-theme/.cursor/commands/validate-section-group.md +88 -0
- package/ts-dist/mocks/init-theme/.cursor/commands/validate-theme-settings.md +119 -0
- package/ts-dist/mocks/init-theme/.cursor/examples/design-instructions-template.md +151 -0
- package/ts-dist/mocks/init-theme/.cursor/mcp.json +18 -0
- package/ts-dist/mocks/init-theme/.cursor/rules/README.md +160 -0
- package/ts-dist/mocks/init-theme/.cursor/rules/accessibility.mdc +24 -0
- package/ts-dist/mocks/init-theme/.cursor/rules/add-field.mdc +222 -0
- package/ts-dist/mocks/init-theme/.cursor/rules/add-theme-setting.mdc +39 -0
- package/ts-dist/mocks/init-theme/.cursor/rules/assemble-page.mdc +130 -0
- package/ts-dist/mocks/init-theme/.cursor/rules/audit-page.mdc +92 -0
- package/ts-dist/mocks/init-theme/.cursor/rules/build-section.mdc +178 -0
- package/ts-dist/mocks/init-theme/.cursor/rules/build-theme.mdc +47 -0
- package/ts-dist/mocks/init-theme/.cursor/rules/compare-section.mdc +94 -0
- package/ts-dist/mocks/init-theme/.cursor/rules/create-theme.mdc +78 -0
- package/ts-dist/mocks/init-theme/.cursor/rules/css.mdc +137 -0
- package/ts-dist/mocks/init-theme/.cursor/rules/design-spec-extraction.mdc +255 -0
- package/ts-dist/mocks/init-theme/.cursor/rules/extract-tokens.mdc +43 -0
- package/ts-dist/mocks/init-theme/.cursor/rules/figma-mcp-resolution.mdc +40 -0
- package/ts-dist/mocks/init-theme/.cursor/rules/fix-section.mdc +154 -0
- package/ts-dist/mocks/init-theme/.cursor/rules/general.mdc +30 -0
- package/ts-dist/mocks/init-theme/.cursor/rules/i18n.mdc +85 -0
- package/ts-dist/mocks/init-theme/.cursor/rules/javascript.mdc +85 -0
- package/ts-dist/mocks/init-theme/.cursor/rules/liquid-no-hardcoded-strings.mdc +42 -0
- package/ts-dist/mocks/init-theme/.cursor/rules/liquid.mdc +171 -0
- package/ts-dist/mocks/init-theme/.cursor/rules/mobile-desktop-setting-meta.mdc +34 -0
- package/ts-dist/mocks/init-theme/.cursor/rules/naming-convention.mdc +64 -0
- package/ts-dist/mocks/init-theme/.cursor/rules/pages.mdc +120 -0
- package/ts-dist/mocks/init-theme/.cursor/rules/performance.mdc +51 -0
- package/ts-dist/mocks/init-theme/.cursor/rules/qa-section.mdc +134 -0
- package/ts-dist/mocks/init-theme/.cursor/rules/redesign-section.mdc +147 -0
- package/ts-dist/mocks/init-theme/.cursor/rules/schema-sync.mdc +110 -0
- package/ts-dist/mocks/init-theme/.cursor/rules/schema.mdc +360 -0
- package/ts-dist/mocks/init-theme/.cursor/rules/share-urls.mdc +68 -0
- package/ts-dist/mocks/init-theme/.cursor/skills/browser-verify.md +128 -0
- package/ts-dist/mocks/init-theme/.cursor/skills/design-tokens.md +105 -0
- package/ts-dist/mocks/init-theme/.cursor/skills/page-json-contract.md +87 -0
- package/ts-dist/mocks/init-theme/.cursor/skills/qa-accessibility.md +35 -0
- package/ts-dist/mocks/init-theme/.cursor/skills/reference-lookup.md +88 -0
- package/ts-dist/mocks/init-theme/.cursor/skills/section-anatomy.md +173 -0
package/ts-dist/mocks/init-theme/.claude/skills/theme-from-figma/zcommerce-docs/reference/tags.md
ADDED
|
@@ -0,0 +1,259 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "Tags"
|
|
3
|
+
weight: 12
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Tags
|
|
7
|
+
|
|
8
|
+
Tags create logic and control flow in templates. They are wrapped in `{% %}` delimiters and do not produce visible output on their own.
|
|
9
|
+
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
## Control Flow
|
|
13
|
+
|
|
14
|
+
### if / elsif / else
|
|
15
|
+
|
|
16
|
+
```liquid
|
|
17
|
+
{% if product.available %}
|
|
18
|
+
<button>Add to Cart</button>
|
|
19
|
+
{% elsif product.coming_soon %}
|
|
20
|
+
<button disabled>Coming Soon</button>
|
|
21
|
+
{% else %}
|
|
22
|
+
<span>Sold Out</span>
|
|
23
|
+
{% endif %}
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
### unless
|
|
27
|
+
|
|
28
|
+
Executes the block if the condition is **false** (opposite of `if`):
|
|
29
|
+
|
|
30
|
+
```liquid
|
|
31
|
+
{% unless product.available %}
|
|
32
|
+
<span>Sold Out</span>
|
|
33
|
+
{% endunless %}
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
### case / when
|
|
37
|
+
|
|
38
|
+
```liquid
|
|
39
|
+
{% case section.settings.layout %}
|
|
40
|
+
{% when "grid" %}
|
|
41
|
+
<span>Grid view</span>
|
|
42
|
+
{% when "list" %}
|
|
43
|
+
<span>List view</span>
|
|
44
|
+
{% else %}
|
|
45
|
+
<span>Default layout</span>
|
|
46
|
+
{% endcase %}
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
---
|
|
50
|
+
|
|
51
|
+
## Iteration
|
|
52
|
+
|
|
53
|
+
### for
|
|
54
|
+
|
|
55
|
+
Loops through arrays and collections:
|
|
56
|
+
|
|
57
|
+
```liquid
|
|
58
|
+
{% for product in collection.products %}
|
|
59
|
+
<div class="product">
|
|
60
|
+
<h3>{{ product.title }}</h3>
|
|
61
|
+
<p>{{ product.price }}</p>
|
|
62
|
+
</div>
|
|
63
|
+
{% endfor %}
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
#### for Parameters
|
|
67
|
+
|
|
68
|
+
| Parameter | Description | Example |
|
|
69
|
+
|-----------|-------------|---------|
|
|
70
|
+
| `limit` | Max iterations | `{% for item in array limit: 5 %}` |
|
|
71
|
+
| `offset` | Skip first N items | `{% for item in array offset: 2 %}` |
|
|
72
|
+
| `reversed` | Reverse order | `{% for item in array reversed %}` |
|
|
73
|
+
|
|
74
|
+
#### forloop Object
|
|
75
|
+
|
|
76
|
+
Available inside every `for` loop:
|
|
77
|
+
|
|
78
|
+
| Property | Description |
|
|
79
|
+
|----------|-------------|
|
|
80
|
+
| `forloop.index` | Current index (1-based) |
|
|
81
|
+
| `forloop.index0` | Current index (0-based) |
|
|
82
|
+
| `forloop.first` | `true` on first iteration |
|
|
83
|
+
| `forloop.last` | `true` on last iteration |
|
|
84
|
+
| `forloop.length` | Total number of items |
|
|
85
|
+
| `forloop.rindex` | Reverse index (1-based) |
|
|
86
|
+
|
|
87
|
+
```liquid
|
|
88
|
+
{% for product in collection.products %}
|
|
89
|
+
<div class="product {% if forloop.first %}first{% endif %}">
|
|
90
|
+
<span>{{ forloop.index }} of {{ forloop.length }}</span>
|
|
91
|
+
{{ product.title }}
|
|
92
|
+
</div>
|
|
93
|
+
{% endfor %}
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
### for / else
|
|
97
|
+
|
|
98
|
+
The `else` block runs when the array is empty:
|
|
99
|
+
|
|
100
|
+
```liquid
|
|
101
|
+
{% for product in collection.products %}
|
|
102
|
+
{{ product.title }}
|
|
103
|
+
{% else %}
|
|
104
|
+
<p>No products found.</p>
|
|
105
|
+
{% endfor %}
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
### Range Loops
|
|
109
|
+
|
|
110
|
+
```liquid
|
|
111
|
+
{% for i in (1..5) %}
|
|
112
|
+
<span>{{ i }}</span>
|
|
113
|
+
{% endfor %}
|
|
114
|
+
<!-- Output: 1 2 3 4 5 -->
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
---
|
|
118
|
+
|
|
119
|
+
## Variable Tags
|
|
120
|
+
|
|
121
|
+
### liquid
|
|
122
|
+
|
|
123
|
+
Allows writing multiple Liquid statements without repeating `{% %}` delimiters:
|
|
124
|
+
|
|
125
|
+
```liquid
|
|
126
|
+
{% liquid
|
|
127
|
+
assign product_title = product.title | upcase
|
|
128
|
+
assign show_sale = product.on_sale
|
|
129
|
+
%}
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
Useful for complex logic that would otherwise require many separate tags. Each statement goes on its own line without `{% %}`.
|
|
133
|
+
|
|
134
|
+
### assign
|
|
135
|
+
|
|
136
|
+
Creates a new variable:
|
|
137
|
+
|
|
138
|
+
```liquid
|
|
139
|
+
{% assign greeting = "Hello" %}
|
|
140
|
+
{% assign full_name = customer.first_name | append: " " | append: customer.last_name %}
|
|
141
|
+
{{ greeting }}, {{ full_name }}
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
### capture
|
|
145
|
+
|
|
146
|
+
Captures a block of content into a variable:
|
|
147
|
+
|
|
148
|
+
```liquid
|
|
149
|
+
{% capture product_card %}
|
|
150
|
+
<div class="card">
|
|
151
|
+
<h3>{{ product.title }}</h3>
|
|
152
|
+
<p>{{ product.price }}</p>
|
|
153
|
+
</div>
|
|
154
|
+
{% endcapture %}
|
|
155
|
+
|
|
156
|
+
{{ product_card }}
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
### increment / decrement
|
|
160
|
+
|
|
161
|
+
Creates and modifies a counter:
|
|
162
|
+
|
|
163
|
+
```liquid
|
|
164
|
+
{% increment counter %} <!-- 0 -->
|
|
165
|
+
{% increment counter %} <!-- 1 -->
|
|
166
|
+
{% increment counter %} <!-- 2 -->
|
|
167
|
+
|
|
168
|
+
{% decrement counter %} <!-- -1 -->
|
|
169
|
+
{% decrement counter %} <!-- -2 -->
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
> `increment` and `decrement` create their own independent counters that don't affect variables created by `assign`.
|
|
173
|
+
|
|
174
|
+
---
|
|
175
|
+
|
|
176
|
+
## Template Tags
|
|
177
|
+
|
|
178
|
+
### render
|
|
179
|
+
|
|
180
|
+
Includes a snippet file. Variables must be passed explicitly:
|
|
181
|
+
|
|
182
|
+
```liquid
|
|
183
|
+
{% render 'product-card', product: item, show_price: true %}
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
> Snippets have isolated scope — they cannot access parent template variables.
|
|
187
|
+
|
|
188
|
+
### sections
|
|
189
|
+
|
|
190
|
+
Renders a named section group (Zoho Commerce-specific tag — not standard Liquid). Used in layouts to render the header and footer groups defined by their corresponding JSON files in `sections/`:
|
|
191
|
+
|
|
192
|
+
```liquid
|
|
193
|
+
{% sections 'header-group' %}
|
|
194
|
+
{% sections 'footer-group' %}
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
> See [Layouts](/layouts/) for how section groups work and how their JSON files are structured.
|
|
198
|
+
|
|
199
|
+
### schema
|
|
200
|
+
|
|
201
|
+
Defines section settings (JSON, once per section file):
|
|
202
|
+
|
|
203
|
+
```liquid
|
|
204
|
+
{% schema %}
|
|
205
|
+
{
|
|
206
|
+
"name": "My Section",
|
|
207
|
+
"settings": [
|
|
208
|
+
{ "type": "text", "id": "title", "label": "Title", "default": "Hello" }
|
|
209
|
+
]
|
|
210
|
+
}
|
|
211
|
+
{% endschema %}
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
### comment
|
|
215
|
+
|
|
216
|
+
Content inside is not rendered:
|
|
217
|
+
|
|
218
|
+
```liquid
|
|
219
|
+
{% comment %}
|
|
220
|
+
This is a developer note. It won't appear in the HTML output.
|
|
221
|
+
{% endcomment %}
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
---
|
|
225
|
+
|
|
226
|
+
## Output Control
|
|
227
|
+
|
|
228
|
+
### raw
|
|
229
|
+
|
|
230
|
+
Outputs Liquid syntax as plain text without processing:
|
|
231
|
+
|
|
232
|
+
```liquid
|
|
233
|
+
{% raw %}
|
|
234
|
+
{{ this.will.not.be.processed }}
|
|
235
|
+
{% endraw %}
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
### Whitespace Control
|
|
239
|
+
|
|
240
|
+
Add `-` to tag delimiters to strip whitespace:
|
|
241
|
+
|
|
242
|
+
```liquid
|
|
243
|
+
{%- assign name = "World" -%}
|
|
244
|
+
Hello, {{ name }}!
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
Without `-`, extra blank lines appear in the output. Use whitespace control in loops and conditionals to keep HTML clean.
|
|
248
|
+
|
|
249
|
+
---
|
|
250
|
+
|
|
251
|
+
## Tag Quick Reference
|
|
252
|
+
|
|
253
|
+
| Category | Tags |
|
|
254
|
+
|----------|------|
|
|
255
|
+
| **Control Flow** | `if`, `elsif`, `else`, `endif`, `unless`, `endunless`, `case`, `when`, `endcase` |
|
|
256
|
+
| **Iteration** | `for`, `endfor`, `else` (empty), `break`, `continue` |
|
|
257
|
+
| **Variables** | `liquid`, `assign`, `capture`, `endcapture`, `increment`, `decrement` |
|
|
258
|
+
| **Template** | `render`, `sections` (Zoho-specific), `schema`, `endschema`, `comment`, `endcomment` |
|
|
259
|
+
| **Output** | `raw`, `endraw`, whitespace control (`-`) |
|
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "Sections"
|
|
3
|
+
weight: 5
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Sections
|
|
7
|
+
|
|
8
|
+
Sections are reusable, configurable content modules. Each section is a `.liquid` file in the `sections/` folder with a JSON schema that defines settings and blocks.
|
|
9
|
+
|
|
10
|
+
## Section Structure
|
|
11
|
+
|
|
12
|
+
```liquid
|
|
13
|
+
<section class="banner-section">
|
|
14
|
+
{% assign img = section.settings.banner_image %}
|
|
15
|
+
{% if img.url != blank %}
|
|
16
|
+
<img src="{{ img.url | asset_url }}" alt="{{ img.alt_text }}" loading="lazy"
|
|
17
|
+
style="filter: {{ img.filters.filter }}; opacity: {{ img.filters.opacity }};">
|
|
18
|
+
{% endif %}
|
|
19
|
+
|
|
20
|
+
<div class="banner-content">
|
|
21
|
+
{% for block in section.blocks %}
|
|
22
|
+
{% case block.type %}
|
|
23
|
+
{% when 'heading' %}
|
|
24
|
+
<h2 {{ block.zcommerce_attributes }}>{{ block.settings.heading }}</h2>
|
|
25
|
+
{% when 'sub-heading' %}
|
|
26
|
+
<p {{ block.zcommerce_attributes }}>{{ block.settings.sub_heading }}</p>
|
|
27
|
+
{% when 'button' %}
|
|
28
|
+
<a href="{{ block.settings.button_link.handle }}" class="btn" {{ block.zcommerce_attributes }}>
|
|
29
|
+
{{ block.settings.button_label }}
|
|
30
|
+
</a>
|
|
31
|
+
{% endcase %}
|
|
32
|
+
{% endfor %}
|
|
33
|
+
</div>
|
|
34
|
+
</section>
|
|
35
|
+
|
|
36
|
+
{% schema %}
|
|
37
|
+
{
|
|
38
|
+
"name": "t:sections.banner.name",
|
|
39
|
+
"category": "Banner",
|
|
40
|
+
"tag": "section",
|
|
41
|
+
"class": "section banner-section",
|
|
42
|
+
"available_in": {"templates": ["index", "collection", "category"]},
|
|
43
|
+
"settings": [
|
|
44
|
+
{
|
|
45
|
+
"type": "image_picker",
|
|
46
|
+
"id": "banner_image",
|
|
47
|
+
"label": "t:sections.banner.settings.banner_image.label",
|
|
48
|
+
"default": { "url": "home_banner.webp", "enable_customisation": true },
|
|
49
|
+
"meta": "desktop"
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
"type": "preview_layout",
|
|
53
|
+
"id": "content_alignment",
|
|
54
|
+
"label": "t:sections.banner.settings.content_alignment.label",
|
|
55
|
+
"options": [
|
|
56
|
+
{ "value": "left", "label": "t:sections.banner.settings.content_alignment.options.left" },
|
|
57
|
+
{ "value": "center", "label": "t:sections.banner.settings.content_alignment.options.center" },
|
|
58
|
+
{ "value": "right", "label": "t:sections.banner.settings.content_alignment.options.right" }
|
|
59
|
+
],
|
|
60
|
+
"default": { "display_name": "t:sections.banner.settings.content_alignment.default", "value": "left" },
|
|
61
|
+
"meta": "desktop"
|
|
62
|
+
}
|
|
63
|
+
],
|
|
64
|
+
"blocks": [
|
|
65
|
+
{
|
|
66
|
+
"type": "heading",
|
|
67
|
+
"name": "t:sections.banner.blocks.heading.name",
|
|
68
|
+
"settings": [
|
|
69
|
+
{
|
|
70
|
+
"type": "text",
|
|
71
|
+
"id": "heading",
|
|
72
|
+
"label": "t:sections.banner.blocks.heading.settings.heading.label",
|
|
73
|
+
"default": "Welcome to Our Store"
|
|
74
|
+
}
|
|
75
|
+
]
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
"type": "sub-heading",
|
|
79
|
+
"name": "t:sections.banner.blocks.sub_heading.name",
|
|
80
|
+
"settings": [
|
|
81
|
+
{
|
|
82
|
+
"type": "text",
|
|
83
|
+
"id": "sub_heading",
|
|
84
|
+
"label": "t:sections.banner.blocks.sub_heading.settings.sub_heading.label",
|
|
85
|
+
"default": "Discover amazing products"
|
|
86
|
+
}
|
|
87
|
+
]
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
"type": "button",
|
|
91
|
+
"name": "t:sections.banner.blocks.button.name",
|
|
92
|
+
"limit": 2,
|
|
93
|
+
"settings": [
|
|
94
|
+
{
|
|
95
|
+
"type": "text",
|
|
96
|
+
"id": "button_label",
|
|
97
|
+
"label": "t:sections.banner.blocks.button.settings.label.label",
|
|
98
|
+
"default": "Shop Now"
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
"type": "url",
|
|
102
|
+
"id": "button_link",
|
|
103
|
+
"label": "t:sections.banner.blocks.button.settings.link.label",
|
|
104
|
+
"default": { "display_name": "t:sections.banner.blocks.button.settings.link.default", "handle": "collections/all-products" }
|
|
105
|
+
}
|
|
106
|
+
]
|
|
107
|
+
}
|
|
108
|
+
]
|
|
109
|
+
}
|
|
110
|
+
{% endschema %}
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
---
|
|
114
|
+
|
|
115
|
+
## Schema
|
|
116
|
+
|
|
117
|
+
The `{% schema %}` tag defines the section's configuration. It must contain valid JSON and appears once per section file.
|
|
118
|
+
|
|
119
|
+
### Top-Level Properties
|
|
120
|
+
|
|
121
|
+
| Property | Type | Description |
|
|
122
|
+
|----------|------|-------------|
|
|
123
|
+
| `name` | string | Display name in the theme editor (use `t:` prefix for translations) |
|
|
124
|
+
| `category` | string | Section category for grouping in admin |
|
|
125
|
+
| `tag` | string | HTML element for wrapper (default: `div`) |
|
|
126
|
+
| `class` | string | CSS class(es) for section wrapper |
|
|
127
|
+
| `available_in` | object | Templates where section can be used |
|
|
128
|
+
| `settings` | array | Section-level settings (see [Schema Types](./reference/schema-types)) |
|
|
129
|
+
| `blocks` | array | Repeatable content modules within the section |
|
|
130
|
+
| `limit` | number | Maximum instances of this section per page |
|
|
131
|
+
|
|
132
|
+
---
|
|
133
|
+
|
|
134
|
+
## Blocks
|
|
135
|
+
|
|
136
|
+
Blocks are repeatable items inside a section. Each block has its own type, name, and settings.
|
|
137
|
+
|
|
138
|
+
### Block Schema
|
|
139
|
+
|
|
140
|
+
```json
|
|
141
|
+
{
|
|
142
|
+
"type": "heading",
|
|
143
|
+
"name": "t:sections.banner.blocks.heading.name",
|
|
144
|
+
"settings": [
|
|
145
|
+
{
|
|
146
|
+
"type": "text",
|
|
147
|
+
"id": "heading",
|
|
148
|
+
"label": "t:sections.banner.blocks.heading.settings.heading.label",
|
|
149
|
+
"default": "Welcome to Our Store"
|
|
150
|
+
}
|
|
151
|
+
]
|
|
152
|
+
}
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
Common block types used in themes include: `heading`, `sub-heading`, `button`, `image`, `description`.
|
|
156
|
+
|
|
157
|
+
**Field type rule:** heading/title blocks use `type: "text"` settings only. Description/content blocks use `type: "richtext"`. Never use `richtext` for heading blocks.
|
|
158
|
+
|
|
159
|
+
### Rendering Blocks
|
|
160
|
+
|
|
161
|
+
```liquid
|
|
162
|
+
{% for block in section.blocks %}
|
|
163
|
+
{% case block.type %}
|
|
164
|
+
{% when 'heading' %}
|
|
165
|
+
<h2 {{ block.zcommerce_attributes }}>{{ block.settings.heading }}</h2>
|
|
166
|
+
{% when 'sub-heading' %}
|
|
167
|
+
<p {{ block.zcommerce_attributes }}>{{ block.settings.sub_heading }}</p>
|
|
168
|
+
{% when 'button' %}
|
|
169
|
+
<a href="{{ block.settings.button_link.handle }}" {{ block.zcommerce_attributes }}>
|
|
170
|
+
{{ block.settings.button_label }}
|
|
171
|
+
</a>
|
|
172
|
+
{% endcase %}
|
|
173
|
+
{% endfor %}
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
### Block Variables
|
|
177
|
+
|
|
178
|
+
| Variable | Description |
|
|
179
|
+
|----------|-------------|
|
|
180
|
+
| `block.type` | The block's type identifier |
|
|
181
|
+
| `block.settings` | Object containing the block's setting values |
|
|
182
|
+
| `block.zcommerce_attributes` | Required HTML attributes for Zoho Commerce editor interaction |
|
|
183
|
+
|
|
184
|
+
> **Important:** Always include `{{ block.zcommerce_attributes }}` on the block's outermost HTML element. This enables drag-and-drop and inline editing in the theme editor.
|
|
185
|
+
|
|
186
|
+
---
|
|
187
|
+
|
|
188
|
+
## Accessing Section Settings
|
|
189
|
+
|
|
190
|
+
```liquid
|
|
191
|
+
<!-- Section-level setting -->
|
|
192
|
+
{{ section.settings.title }}
|
|
193
|
+
|
|
194
|
+
<!-- Block setting inside a loop -->
|
|
195
|
+
{% for block in section.blocks %}
|
|
196
|
+
{{ block.settings.heading }}
|
|
197
|
+
{% endfor %}
|
|
198
|
+
|
|
199
|
+
<!-- Accessing select/radio values -->
|
|
200
|
+
{{ section.settings.layout_style.value }}
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
For a complete list of available setting types, defaults, and output formats, see [Schema Types](./reference/schema-types).
|