@bettercms-ai/mcp 0.68.2 → 0.69.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.
@@ -0,0 +1,725 @@
1
+ ---
2
+ title: "Worked examples"
3
+ description: "Five conversions from source HTML to a production schema, a production value and a bound template: hero, feature grid, pricing with a comparison table, testimonials as a collection, FAQ with FAQPage markup."
4
+ ---
5
+
6
+ # Worked examples: source HTML to schema, value and bound template
7
+
8
+ Each example runs the same five steps: the source markup (trimmed), what it is and why, the
9
+ schema as the write tool takes it, the value as the write tool takes it, and the template with
10
+ its binding attributes. Copy the shape, never the customer's words. Rules behind the shapes:
11
+ [content-modeling.md](content-modeling.md), [components.md](components.md),
12
+ [bindings.md](bindings.md), [portable-text.md](portable-text.md). Examples 6 to 8 continue in
13
+ [worked-examples-advanced.md](worked-examples-advanced.md).
14
+
15
+ ## Contents
16
+
17
+ - [Which shape each example uses](#which-shape-each-example-uses)
18
+ - [1. Hero with two buttons and a background image](#1-hero-with-two-buttons-and-a-background-image)
19
+ - [2. Feature grid with icons](#2-feature-grid-with-icons)
20
+ - [3. Pricing plans with a comparison table](#3-pricing-plans-with-a-comparison-table)
21
+ - [4. Testimonials kept as a collection](#4-testimonials-kept-as-a-collection)
22
+ - [5. FAQ accordion with FAQPage markup](#5-faq-accordion-with-faqpage-markup)
23
+ - [Checks after any example](#checks-after-any-example)
24
+ - Examples 6 to 8 (blog post as an entry, mega menu in the Global Layout, tabs holding columns
25
+ of cards): [worked-examples-advanced.md](worked-examples-advanced.md)
26
+
27
+ ## Which shape each example uses
28
+
29
+ Production stores content in four places. Pick by what the markup is, then follow that example.
30
+
31
+ | Markup | Stored as | Schema tool | Value tool | Address on the page | Example |
32
+ |---|---|---|---|---|---|
33
+ | A band one page owns | Page fields, keys prefixed by section | `create_page` `fields`, `add_field` | `set_page_content` | `data-bcms-field="<key>"` | 1, 2, 5 |
34
+ | A band reused or with variants | Component with props | `create_component` | `compose_pages` (an instance per page) | `<instanceId>__overrides.<key>` | 3 |
35
+ | Records that repeat on one route | Content model and entries | `create_content_model` | `create_content_entry` | the entry's field key | 4, 6 (advanced) |
36
+ | Header, footer, promo bar | Global Layout Section | `update_layout` | `update_layout` | `data-bcms-layout-field` | 7 (advanced) |
37
+ | A one-off band built from blocks | `section` block with child blocks | `update_page` `blockJson` | the same call | `<blockId>__<prop>` | 8 (advanced) |
38
+
39
+ Rules that hold in every example:
40
+
41
+ - A key is unique in its whole model, so a page field carries its section: `"hero_title"`,
42
+ `"faq_title"`. Prop keys and sub-field keys live inside one component and stay short.
43
+ - A field of type `text` is created as rich text. Send `richText: false` for every plain string
44
+ (a title, an eyebrow, a name, an icon name), then write it as a bare string.
45
+ - A repeater value is `{ "repeatable": [ ...rows ] }`; a row is addressed `<key>[<n>].<childKey>`.
46
+ - Bind the element that renders the value. Never a wrapper, never a list container.
47
+ - `set_page_content` merges by top-level key. `compose_pages` and `update_page` `blockJson`
48
+ replace the page's whole block array: read `get_page` first and send every block back.
49
+
50
+ ## 1. Hero with two buttons and a background image
51
+
52
+ Source: a freight-tracking home page.
53
+
54
+ ```html
55
+ <section class="hero relative isolate overflow-hidden" id="top">
56
+ <picture class="absolute inset-0 -z-10">
57
+ <source type="image/avif" srcset="/img/hero-harbor-1280.avif 1280w, /img/hero-harbor-2560.avif 2560w">
58
+ <img src="/img/hero-harbor-1280.jpg" alt="Container cranes over a quiet harbor at dusk"
59
+ class="h-full w-full object-cover object-[50%_35%]" width="2560" height="1440">
60
+ </picture>
61
+ <div class="absolute inset-0 -z-10 bg-slate-950/50" aria-hidden="true"></div>
62
+ <div class="mx-auto max-w-6xl px-6 py-32 text-white">
63
+ <p class="text-sm uppercase text-teal-300">Freight visibility for mid-size shippers</p>
64
+ <h1 class="mt-4 text-5xl font-bold">Know where every container is before your customer asks.</h1>
65
+ <p class="mt-6 text-lg">Live ETAs from 140 carriers, delays flagged before they cost you, and one shared view for ops and sales.</p>
66
+ <a href="/demo" class="btn btn-primary">Book a demo <svg class="icon-arrow-right" aria-hidden="true"/></a>
67
+ <a href="https://app.kestrelfreight.com/signup" class="btn btn-ghost">Start free trial</a>
68
+ <p class="mt-8 text-sm"><span class="stars" role="img" aria-label="Rated 4.8 out of 5">★★★★★</span> 4.8 on G2 from 310 reviews</p>
69
+ </div>
70
+ </section>
71
+ ```
72
+
73
+ Reasoning:
74
+
75
+ 1. One `<h1>`, a lede, two links styled as buttons, a photo behind the copy: the page's opening
76
+ band. Other pages write their own hero copy, so this is page fields, not chrome.
77
+ 2. The uppercase line, the heading and the paragraph carry no links or emphasis: three plain
78
+ strings.
79
+ 3. Each `<a class="btn">` is one `button` field. Label, link and look travel together; the
80
+ trailing arrow is the button's `arrow`, not content.
81
+ 4. The `<picture>` is one `image` field. Store the largest source once and copy the `alt`. The CSS
82
+ `object-position: 50% 35%` is the focal point: divide by 100, so `{ x: 0.5, y: 0.35 }`.
83
+ 5. The stars are drawn from the number. Store `4.8` and the label; never the glyphs.
84
+ 6. The scrim, the padding and the teal colour are design. They stay in the site's classes.
85
+
86
+ Schema (`create_page` `fields`, or one `add_field` with `pageId` per field):
87
+
88
+ ```json
89
+ [
90
+ { "key": "hero_eyebrow", "label": "Eyebrow", "type": "text", "richText": false },
91
+ { "key": "hero_title", "label": "Heading", "type": "text", "richText": false, "required": true },
92
+ { "key": "hero_lede", "label": "Supporting text", "type": "text", "richText": false },
93
+ { "key": "hero_primary", "label": "Primary button", "type": "button" },
94
+ { "key": "hero_secondary", "label": "Secondary button", "type": "button" },
95
+ { "key": "hero_image", "label": "Background image", "type": "image",
96
+ "helpText": "Fills the whole band behind the text. Use a photo at least 2560 px wide." },
97
+ { "key": "hero_rating", "label": "Rating", "type": "number", "config": { "min": 0, "max": 5, "step": 0.1 } },
98
+ { "key": "hero_rating_label", "label": "Rating source", "type": "text", "richText": false }
99
+ ]
100
+ ```
101
+
102
+ Value (`set_page_content`):
103
+
104
+ ```json
105
+ {
106
+ "pageId": "<home page id>",
107
+ "data": {
108
+ "hero_eyebrow": "Freight visibility for mid-size shippers",
109
+ "hero_title": "Know where every container is before your customer asks.",
110
+ "hero_lede": "Live ETAs from 140 carriers, delays flagged before they cost you, and one shared view for ops and sales.",
111
+ "hero_primary": { "label": "Book a demo", "href": "/demo", "variant": "primary", "arrow": true },
112
+ "hero_secondary": { "label": "Start free trial", "href": "https://app.kestrelfreight.com/signup", "variant": "secondary" },
113
+ "hero_image": {
114
+ "url": "/img/hero-harbor-2560.jpg",
115
+ "altText": "Container cranes over a quiet harbor at dusk",
116
+ "focal": { "x": 0.5, "y": 0.35 }
117
+ },
118
+ "hero_rating": 4.8,
119
+ "hero_rating_label": "on G2 from 310 reviews"
120
+ }
121
+ }
122
+ ```
123
+
124
+ Bound template (classes unchanged, shortened here):
125
+
126
+ ```html
127
+ <section class="hero ..." id="top">
128
+ <picture class="absolute inset-0 -z-10">
129
+ <img src="/img/hero-harbor-1280.jpg" alt="Container cranes over a quiet harbor at dusk"
130
+ data-bcms-field="hero_image" data-bcms-kind="image">
131
+ </picture>
132
+ <div class="absolute inset-0 -z-10 bg-slate-950/50" aria-hidden="true"></div>
133
+ <p data-bcms-field="hero_eyebrow" data-bcms-kind="text">Freight visibility for mid-size shippers</p>
134
+ <h1 data-bcms-field="hero_title" data-bcms-kind="text">Know where every container is before your customer asks.</h1>
135
+ <p data-bcms-field="hero_lede" data-bcms-kind="text">Live ETAs from 140 carriers, ...</p>
136
+ <a class="btn btn-primary" href="/demo" data-bcms-button="hero_primary"
137
+ data-bcms-props="hero_primary.href|url|href">
138
+ <span data-bcms-field="hero_primary.label" data-bcms-kind="text">Book a demo</span></a>
139
+ <a class="btn btn-ghost" href="https://app.kestrelfreight.com/signup" data-bcms-button="hero_secondary"
140
+ data-bcms-props="hero_secondary.href|url|href">
141
+ <span data-bcms-field="hero_secondary.label" data-bcms-kind="text">Start free trial</span></a>
142
+ <p><span class="stars" role="img" aria-label="Rated 4.8 out of 5">★★★★★</span>
143
+ <span data-bcms-field="hero_rating">4.8</span>
144
+ <span data-bcms-field="hero_rating_label" data-bcms-kind="text">on G2 from 310 reviews</span></p>
145
+ </section>
146
+ ```
147
+
148
+ - The image binding sits on the `<img>`, not the `<picture>`. The alt text travels in the image
149
+ value (`altText`): a publish writes it to the bound element's `alt`. When `get_conversion_brief`
150
+ lists a separate alt path, declare that path in `data-bcms-props` with kind `text`.
151
+ - An `href` is kind `url`, never `text`. The label gets its own `<span>` so a save does not erase
152
+ the arrow; the arrow is drawn by `BcmsButton` ([components.md](components.md)), so remove the
153
+ hand-written `<svg>` once the button renders through it.
154
+ - A number shown as text binds with no kind. `number` is a kind only inside `data-bcms-props`.
155
+ - The image value's `focal` frames this placement only; the asset's own focal point is untouched.
156
+
157
+ Not available today: an overlay, height or theme token on the section. The scrim and spacing stay
158
+ in the template's classes and change in code.
159
+
160
+ ## 2. Feature grid with icons
161
+
162
+ Source: a finance SaaS product page.
163
+
164
+ ```html
165
+ <section class="features py-24" aria-labelledby="features-title">
166
+ <span class="kicker">Why teams switch</span>
167
+ <h2 id="features-title">Everything your finance team asked for, in one close.</h2>
168
+ <p class="lede">Ledgerly connects to your bank, your payroll and your ERP, then does the matching for you.</p>
169
+ <ul class="grid gap-8 md:grid-cols-3" role="list">
170
+ <li class="feature-card">
171
+ <span class="icon-tile"><svg class="lucide lucide-zap" aria-hidden="true"><use href="#zap"/></svg></span>
172
+ <h3>Close in two days</h3>
173
+ <p>Auto-matching clears 92% of transactions before anyone opens a spreadsheet.</p>
174
+ <a class="text-link" href="/product/reconciliation">How matching works <span aria-hidden="true">→</span></a>
175
+ </li>
176
+ <li class="feature-card">
177
+ <span class="icon-tile"><svg class="lucide lucide-shield-check" aria-hidden="true"><use href="#shield-check"/></svg></span>
178
+ <h3>Audit-ready by default</h3>
179
+ <p>Every change is logged with who, when and why, so year-end takes hours.</p>
180
+ </li>
181
+ <!-- third card: plug, "40 native integrations", link to /integrations -->
182
+ </ul>
183
+ <a class="btn btn-outline mt-12" href="/product">Explore the product</a>
184
+ </section>
185
+ ```
186
+
187
+ Reasoning:
188
+
189
+ 1. A heading group, then same-shaped `<li>` cards: a repeater. The count and order are the
190
+ editor's; the three-column grid is the template's.
191
+ 2. Per card: the `<h3>` and the `<p>` are plain strings. The trailing link is optional, so the
192
+ second card leaves it empty. Never invent a link to fill the row.
193
+ 3. The icon is a sprite reference (`<use href="#zap"/>`), so the content is its name. Store the
194
+ name the site's own sprite uses (`zap`), as a plain string. An inline `<svg>` with its own
195
+ paths is different: that is an `image` field with `config: { "media": "icon" }`.
196
+ 4. The band's last button is a `button` field of its own, outside the repeater.
197
+
198
+ Schema:
199
+
200
+ ```json
201
+ [
202
+ { "key": "features_eyebrow", "label": "Eyebrow", "type": "text", "richText": false },
203
+ { "key": "features_title", "label": "Heading", "type": "text", "richText": false },
204
+ { "key": "features_intro", "label": "Intro", "type": "text", "richText": false },
205
+ { "key": "features_items", "label": "Features", "type": "repeater",
206
+ "ui": { "preview": { "title": "features_item_title" }, "itemLabel": "Feature" },
207
+ "fields": [
208
+ { "key": "features_item_icon", "label": "Icon", "type": "text", "richText": false,
209
+ "helpText": "Icon name from the site's sprite, lowercase with hyphens: zap, shield-check, plug." },
210
+ { "key": "features_item_title", "label": "Title", "type": "text", "richText": false },
211
+ { "key": "features_item_body", "label": "Description", "type": "text", "richText": false },
212
+ { "key": "features_item_link", "label": "Link", "type": "button" }
213
+ ] },
214
+ { "key": "features_cta", "label": "Button", "type": "button" }
215
+ ]
216
+ ```
217
+
218
+ Value (`set_page_content` `data`):
219
+
220
+ ```json
221
+ {
222
+ "features_eyebrow": "Why teams switch",
223
+ "features_title": "Everything your finance team asked for, in one close.",
224
+ "features_intro": "Ledgerly connects to your bank, your payroll and your ERP, then does the matching for you.",
225
+ "features_items": { "repeatable": [
226
+ { "features_item_icon": "zap", "features_item_title": "Close in two days",
227
+ "features_item_body": "Auto-matching clears 92% of transactions before anyone opens a spreadsheet.",
228
+ "features_item_link": { "label": "How matching works", "href": "/product/reconciliation", "variant": "link" } },
229
+ { "features_item_icon": "shield-check", "features_item_title": "Audit-ready by default",
230
+ "features_item_body": "Every change is logged with who, when and why, so year-end takes hours." },
231
+ { "features_item_icon": "plug", "features_item_title": "40 native integrations",
232
+ "features_item_body": "Banks, payroll and ERPs sync every hour without CSV exports.",
233
+ "features_item_link": { "label": "See integrations", "href": "/integrations", "variant": "link" } }
234
+ ] },
235
+ "features_cta": { "label": "Explore the product", "href": "/product", "variant": "outline" }
236
+ }
237
+ ```
238
+
239
+ Bound template (first card):
240
+
241
+ ```html
242
+ <h2 id="features-title" data-bcms-field="features_title" data-bcms-kind="text">Everything your finance team asked for, in one close.</h2>
243
+ <ul class="grid gap-8 md:grid-cols-3" role="list">
244
+ <li class="feature-card">
245
+ <span class="icon-tile"><svg class="lucide lucide-zap" aria-hidden="true"><use href="#zap"/></svg></span>
246
+ <h3 data-bcms-field="features_items[0].features_item_title" data-bcms-kind="text">Close in two days</h3>
247
+ <p data-bcms-field="features_items[0].features_item_body" data-bcms-kind="text">Auto-matching clears 92% ...</p>
248
+ <a class="text-link" href="/product/reconciliation" data-bcms-button="features_items[0].features_item_link"
249
+ data-bcms-props="features_items[0].features_item_link.href|url|href">
250
+ <span data-bcms-field="features_items[0].features_item_link.label" data-bcms-kind="text">How matching works</span>
251
+ <span aria-hidden="true">→</span></a>
252
+ </li>
253
+ </ul>
254
+ ```
255
+
256
+ - The `<ul>` carries no binding. Rows are added, removed and reordered in the side panel.
257
+ - Emit an address only for a row that exists, and only for a link the row holds.
258
+ - The icon `<svg>` is not bound: no field is read from text inside an SVG. The name is edited in
259
+ the side panel and the template turns it into the sprite reference.
260
+
261
+ Not available today: an `icon` FIELD type with a picker over a named icon set. In a model or
262
+ page field a sprite icon is a plain name; only an inline SVG stored as an `image` with
263
+ `media: "icon"` gets the editor's icon picker. A component prop does have the `icon` type: a
264
+ BetterCMS icon name or an image ([components.md](components.md) §1).
265
+
266
+ ## 3. Pricing plans with a comparison table
267
+
268
+ Source: a social scheduling SaaS. The same band sits on the pricing page and the home page, so
269
+ it is a component.
270
+
271
+ ```html
272
+ <section class="pricing" id="pricing">
273
+ <p class="eyebrow">Pricing</p>
274
+ <h2>Plans that grow with your calendar</h2>
275
+ <div class="billing-toggle" role="radiogroup" aria-label="Billing period">
276
+ <button role="radio" aria-checked="false" data-cycle="monthly">Monthly</button>
277
+ <button role="radio" aria-checked="true" data-cycle="yearly">Yearly <span class="pill">Save 20%</span></button>
278
+ </div>
279
+ <div class="plans grid md:grid-cols-3">
280
+ <article class="plan">
281
+ <h3>Starter</h3><p class="plan__for">For solo creators</p>
282
+ <p class="price"><span class="amount">$0</span></p>
283
+ <ul class="checks"><li>3 social accounts</li><li>30 scheduled posts a month</li></ul>
284
+ <a class="btn btn-outline" href="https://app.cadence.so/signup">Start free</a>
285
+ </article>
286
+ <article class="plan plan--featured">
287
+ <span class="ribbon">Most popular</span>
288
+ <h3>Growth</h3><p class="plan__for">For growing marketing teams</p>
289
+ <p class="price"><span class="amount" data-monthly="30" data-yearly="24">$24</span><span class="per">/mo</span></p>
290
+ <ul class="checks"><li>15 social accounts</li><li>Approval workflows</li><li>AI caption drafts</li></ul>
291
+ <a class="btn btn-primary" href="https://app.cadence.so/signup?plan=growth">Start 14-day trial</a>
292
+ </article>
293
+ <!-- Scale: "For agencies and brands", price "Let's talk", link /contact-sales -->
294
+ </div>
295
+ <table class="compare">
296
+ <thead><tr><th></th><th scope="col">Starter</th><th scope="col">Growth</th><th scope="col">Scale</th></tr></thead>
297
+ <tbody>
298
+ <tr class="group"><th colspan="4" scope="colgroup">Usage</th></tr>
299
+ <tr><th scope="row">Scheduled posts</th><td>30 a month</td><td>Unlimited</td><td>Unlimited</td></tr>
300
+ <tr class="group"><th colspan="4" scope="colgroup">Features</th></tr>
301
+ <tr><th scope="row">AI caption drafts</th><td><svg class="i-x" aria-label="Not included"/></td><td>50 a month</td><td><svg class="i-check" aria-label="Included"/></td></tr>
302
+ </tbody>
303
+ </table>
304
+ <p class="fineprint">Prices in USD, excluding tax. Yearly plans are billed once a year.</p>
305
+ </section>
306
+ ```
307
+
308
+ Reasoning:
309
+
310
+ 1. Plan cards and the comparison table share plan names and always show together: one section.
311
+ 2. Plans are same-shaped rows: one `table` prop. `data-monthly` and `data-yearly` give two
312
+ numbers; store numbers, never `$24/mo`. A price in words ("Let's talk") is its own text key,
313
+ shown when the numbers are empty.
314
+ 3. Each plan's check list is a list inside a row: a nested `table` whose rows hold one string.
315
+ That is the deepest a prop goes: the inner row takes scalars only.
316
+ 4. The comparison is a second `table` prop: one row object per feature, one text key per plan,
317
+ plus the group it sits under. The template prints a group row when `group` changes. Read
318
+ "Included" and "Not included" from `aria-label`, store "Yes" and "No", and let the template
319
+ draw the icon.
320
+ 5. A CTA inside a component is one `button` block that two props target (`text`, `url`).
321
+
322
+ Schema (`create_component`; lands as a draft, then `publish_component`):
323
+
324
+ ```json
325
+ {
326
+ "name": "Pricing / Three plans",
327
+ "slug": "pricing-three-plans",
328
+ "category": "conversion",
329
+ "sectionType": "Pricing",
330
+ "description": "Plan cards with monthly and yearly prices, then a feature comparison.",
331
+ "blockJson": [
332
+ { "type": "section", "id": "pr-root", "props": { "children": [
333
+ { "type": "text", "id": "pr-eyebrow", "props": { "html": "" } },
334
+ { "type": "heading", "id": "pr-heading", "props": { "text": "", "level": 2 } },
335
+ { "type": "text", "id": "pr-saving", "props": { "html": "" } },
336
+ { "type": "section", "id": "pr-plans", "label": "Plans", "props": { "children": [
337
+ { "type": "heading", "id": "pr-plan-name", "props": { "text": "", "level": 3 } },
338
+ { "type": "button", "id": "pr-plan-cta", "props": { "text": "", "href": "" } }
339
+ ] } },
340
+ { "type": "section", "id": "pr-compare", "label": "Comparison", "props": { "children": [
341
+ { "type": "heading", "id": "pr-compare-feature", "props": { "text": "", "level": 4 } }
342
+ ] } },
343
+ { "type": "text", "id": "pr-fineprint", "props": { "html": "" } }
344
+ ] } }
345
+ ],
346
+ "props": [
347
+ { "key": "eyebrow", "label": "Eyebrow", "type": "text", "target": { "blockId": "pr-eyebrow", "path": "props.html" } },
348
+ { "key": "heading", "label": "Heading", "type": "text", "target": { "blockId": "pr-heading", "path": "props.text" } },
349
+ { "key": "saving", "label": "Yearly saving badge", "type": "text", "target": { "blockId": "pr-saving", "path": "props.html" } },
350
+ { "key": "plans", "label": "Plans", "type": "table", "target": { "blockId": "pr-plans", "path": "props.rows" },
351
+ "ui": { "preview": { "title": "name" }, "itemLabel": "Plan" },
352
+ "config": { "fields": [
353
+ { "key": "name", "label": "Name", "type": "text" },
354
+ { "key": "audience", "label": "Who it is for", "type": "text" },
355
+ { "key": "badge", "label": "Badge", "type": "text" },
356
+ { "key": "monthly", "label": "Monthly price", "type": "number", "helpText": "Per month, billed monthly. Digits only." },
357
+ { "key": "yearly", "label": "Yearly price", "type": "number", "helpText": "Per month, when billed yearly. Digits only." },
358
+ { "key": "priceLabel", "label": "Price in words", "type": "text", "helpText": "Shown when both prices are empty." },
359
+ { "key": "features", "label": "Included", "type": "table", "fields": [
360
+ { "key": "line", "label": "Feature", "type": "text" }
361
+ ] },
362
+ { "key": "ctaLabel", "label": "Button label", "type": "text" },
363
+ { "key": "ctaUrl", "label": "Button link", "type": "url" }
364
+ ] } },
365
+ { "key": "comparison", "label": "Comparison rows", "type": "table", "target": { "blockId": "pr-compare", "path": "props.rows" },
366
+ "ui": { "preview": { "title": "feature", "subtitle": "group" }, "itemLabel": "Row" },
367
+ "config": { "fields": [
368
+ { "key": "group", "label": "Group", "type": "text" },
369
+ { "key": "feature", "label": "Feature", "type": "text" },
370
+ { "key": "starter", "label": "Starter", "type": "text" },
371
+ { "key": "growth", "label": "Growth", "type": "text" },
372
+ { "key": "scale", "label": "Scale", "type": "text" }
373
+ ] } },
374
+ { "key": "fineprint", "label": "Fine print", "type": "text", "target": { "blockId": "pr-fineprint", "path": "props.html" } }
375
+ ]
376
+ }
377
+ ```
378
+
379
+ A `table` prop targets `props.rows` of a `section` block whose children mirror one row. On a
380
+ code-built site the repo file draws the band: record it with `set_component_source` as soon as it
381
+ exists.
382
+
383
+ Value (`compose_pages`; one instance, keyed by prop key):
384
+
385
+ ```json
386
+ {
387
+ "pages": [ { "slug": "pricing", "blockJson": [
388
+ { "type": "component", "id": "pricing-01", "props": {
389
+ "componentId": "<id returned by create_component>",
390
+ "overrides": {
391
+ "eyebrow": "Pricing",
392
+ "heading": "Plans that grow with your calendar",
393
+ "saving": "Save 20%",
394
+ "plans": [
395
+ { "name": "Starter", "audience": "For solo creators", "monthly": 0, "yearly": 0,
396
+ "features": [ { "line": "3 social accounts" }, { "line": "30 scheduled posts a month" } ],
397
+ "ctaLabel": "Start free", "ctaUrl": "https://app.cadence.so/signup" },
398
+ { "name": "Growth", "audience": "For growing marketing teams", "badge": "Most popular",
399
+ "monthly": 30, "yearly": 24,
400
+ "features": [ { "line": "15 social accounts" }, { "line": "Approval workflows" }, { "line": "AI caption drafts" } ],
401
+ "ctaLabel": "Start 14-day trial", "ctaUrl": "https://app.cadence.so/signup?plan=growth" },
402
+ { "name": "Scale", "audience": "For agencies and brands", "priceLabel": "Let's talk",
403
+ "features": [ { "line": "Unlimited accounts" }, { "line": "SSO and audit log" } ],
404
+ "ctaLabel": "Talk to sales", "ctaUrl": "/contact-sales" }
405
+ ],
406
+ "comparison": [
407
+ { "group": "Usage", "feature": "Scheduled posts", "starter": "30 a month", "growth": "Unlimited", "scale": "Unlimited" },
408
+ { "group": "Features", "feature": "AI caption drafts", "starter": "No", "growth": "50 a month", "scale": "Yes" }
409
+ ],
410
+ "fineprint": "Prices in USD, excluding tax. Yearly plans are billed once a year."
411
+ } } }
412
+ ] } ]
413
+ }
414
+ ```
415
+
416
+ Bound template (the Growth card and one comparison row; `pricing-01` is the instance id):
417
+
418
+ ```html
419
+ <section class="pricing" id="pricing" data-bcms-block="pricing-01">
420
+ <h2 data-bcms-field="pricing-01__overrides.heading" data-bcms-kind="text">Plans that grow with your calendar</h2>
421
+ <article class="plan plan--featured">
422
+ <span class="ribbon" data-bcms-field="pricing-01__overrides.plans[1].badge" data-bcms-kind="text">Most popular</span>
423
+ <h3 data-bcms-field="pricing-01__overrides.plans[1].name" data-bcms-kind="text">Growth</h3>
424
+ <p class="price"><span class="amount">$<span data-bcms-field="pricing-01__overrides.plans[1].yearly">24</span></span><span class="per">/mo</span></p>
425
+ <ul class="checks">
426
+ <li data-bcms-field="pricing-01__overrides.plans[1].features[0].line" data-bcms-kind="text">15 social accounts</li>
427
+ </ul>
428
+ <a class="btn btn-primary" href="https://app.cadence.so/signup?plan=growth"
429
+ data-bcms-props="pricing-01__overrides.plans[1].ctaUrl|url|href">
430
+ <span data-bcms-field="pricing-01__overrides.plans[1].ctaLabel" data-bcms-kind="text">Start 14-day trial</span></a>
431
+ </article>
432
+ <table class="compare"><tbody>
433
+ <tr><th scope="row" data-bcms-field="pricing-01__overrides.comparison[0].feature" data-bcms-kind="text">Scheduled posts</th>
434
+ <td data-bcms-field="pricing-01__overrides.comparison[0].starter" data-bcms-kind="text">30 a month</td>
435
+ <td data-bcms-field="pricing-01__overrides.comparison[0].growth" data-bcms-kind="text">Unlimited</td>
436
+ <td data-bcms-field="pricing-01__overrides.comparison[0].scale" data-bcms-kind="text">Unlimited</td></tr>
437
+ </tbody></table>
438
+ </section>
439
+ ```
440
+
441
+ - Use the package `bind` and `bindProps` helpers inside an instance; they produce these addresses.
442
+ A definition block id (`pr-heading`) is shared by every instance and binds to nothing.
443
+ - Bind the digits, not `$24/mo`. The symbol and the period come from the template. Bind the price
444
+ on screen; when the switch shows monthly, the address is `.monthly`.
445
+ - A cell the template draws as an icon ("Yes", "No") is not bound: it is edited in the side panel.
446
+ - A comparison written as prose instead belongs in a `richtext` prop as a Portable Text `table`
447
+ ([portable-text.md](portable-text.md)); then the wrapper of that one value is the bound element.
448
+
449
+ Not available today: typed table columns (money, boolean) and a per-cell type; every cell is text
450
+ or one sub-field type for the whole column. Rows keyed to plan ids, and a field only a developer
451
+ can change. Offer markup: no JSON-LD is built from prices. Paste it as `schema` on `update_page`
452
+ when the page needs it. A fourth plan in the comparison is a new sub-field, a schema change.
453
+
454
+ ## 4. Testimonials kept as a collection
455
+
456
+ Source: three quote cards on a home page. The same quotes also show on the pricing and product
457
+ pages.
458
+
459
+ ```html
460
+ <section class="testimonials bg-stone-50 py-24">
461
+ <p class="eyebrow">Customers</p>
462
+ <h2 class="text-3xl">Teams that stopped chasing spreadsheets</h2>
463
+ <div class="cards grid gap-6 md:grid-cols-3">
464
+ <figure class="t-card">
465
+ <div class="stars" role="img" aria-label="5 out of 5 stars">★★★★★</div>
466
+ <blockquote><p>&ldquo;We closed March in a day and a half. Our auditors asked what changed.&rdquo;</p></blockquote>
467
+ <figcaption>
468
+ <img class="avatar" src="/img/people/dana-ruiz.jpg" alt="" width="48" height="48">
469
+ <span class="name">Dana Ruiz</span><span class="role">Controller, Brightwell Foods</span>
470
+ </figcaption>
471
+ </figure>
472
+ <!-- Omar Haddad, VP Finance, Northgate Logistics, 5 stars; Mei Tanaka, Finance Lead, Alder Studio, 4 stars, no photo -->
473
+ </div>
474
+ <a class="btn btn-outline" href="/customers">Read all customer stories</a>
475
+ </section>
476
+ ```
477
+
478
+ Reasoning:
479
+
480
+ 1. Search the site before modelling rows inside the section. The quotes repeat on three pages, so
481
+ each quote is one entry of a content model and is written once.
482
+ 2. Per entry: the quote without the curly quotes (the template adds them), name, role and company
483
+ split at the comma, photo, and the rating read from `aria-label`. Add a consent switch:
484
+ publishing a person's words needs their permission.
485
+ 3. The avatar's `alt=""` is correct: the name sits beside it. Keep the alt text empty.
486
+ 4. The section keeps its own eyebrow, heading and button. How it gets its three quotes depends on
487
+ where it lives (table below).
488
+
489
+ Schema (`create_content_model`), then the home page's own fields:
490
+
491
+ ```json
492
+ {
493
+ "name": "Testimonial",
494
+ "slug": "testimonial",
495
+ "urlPattern": "/customers/:slug",
496
+ "fields": [
497
+ { "key": "quote", "label": "Quote", "type": "text", "richText": false, "required": true,
498
+ "helpText": "Without quotation marks; the page adds them." },
499
+ { "key": "name", "label": "Name", "type": "text", "richText": false, "required": true },
500
+ { "key": "role", "label": "Role", "type": "text", "richText": false },
501
+ { "key": "company", "label": "Company", "type": "text", "richText": false },
502
+ { "key": "photo", "label": "Photo", "type": "image" },
503
+ { "key": "rating", "label": "Rating", "type": "number", "config": { "min": 1, "max": 5, "step": 1 } },
504
+ { "key": "consent", "label": "Permission to publish", "type": "boolean" }
505
+ ]
506
+ }
507
+ ```
508
+
509
+ ```json
510
+ [
511
+ { "key": "testimonials_eyebrow", "label": "Eyebrow", "type": "text", "richText": false },
512
+ { "key": "testimonials_title", "label": "Heading", "type": "text", "richText": false },
513
+ { "key": "testimonials_picks", "label": "Testimonials", "type": "multi-reference",
514
+ "config": { "contentModelId": "<testimonial model id>", "min": 3, "max": 9 },
515
+ "helpText": "Pick 3, 6 or 9 so the grid has no gaps." },
516
+ { "key": "testimonials_cta", "label": "Button", "type": "button" }
517
+ ]
518
+ ```
519
+
520
+ Value: entries first (`create_content_entries`, drafts, ids come back), then the page:
521
+
522
+ ```json
523
+ {
524
+ "contentModelId": "<testimonial model id>",
525
+ "entries": [
526
+ { "slug": "dana-ruiz", "data": { "quote": "We closed March in a day and a half. Our auditors asked what changed.",
527
+ "name": "Dana Ruiz", "role": "Controller", "company": "Brightwell Foods",
528
+ "photo": { "url": "/img/people/dana-ruiz.jpg", "altText": "" }, "rating": 5, "consent": true } },
529
+ { "slug": "omar-haddad", "data": { "quote": "Matching used to eat two people for a week. Now it is a coffee.",
530
+ "name": "Omar Haddad", "role": "VP Finance", "company": "Northgate Logistics",
531
+ "photo": { "url": "/img/people/omar-haddad.jpg", "altText": "" }, "rating": 5, "consent": true } },
532
+ { "slug": "mei-tanaka", "data": { "quote": "The audit log alone paid for it.",
533
+ "name": "Mei Tanaka", "role": "Finance Lead", "company": "Alder Studio", "rating": 4, "consent": true } }
534
+ ]
535
+ }
536
+ ```
537
+
538
+ ```json
539
+ {
540
+ "pageId": "<home page id>",
541
+ "data": {
542
+ "testimonials_eyebrow": "Customers",
543
+ "testimonials_title": "Teams that stopped chasing spreadsheets",
544
+ "testimonials_picks": ["<dana entry id>", "<omar entry id>", "<mei entry id>"],
545
+ "testimonials_cta": { "label": "Read all customer stories", "href": "/customers", "variant": "outline" }
546
+ }
547
+ }
548
+ ```
549
+
550
+ A reference value is the entry id as a string; a multi-reference is a list of them. An id that
551
+ does not exist is refused with a 400 ("ref_missing"), so create the entries before the page value.
552
+
553
+ How a band shows the entries, by where it lives:
554
+
555
+ | Where | What production supports |
556
+ |---|---|
557
+ | A code-built page (this example) | A `multi-reference` page field holds the picked ids; the template reads the entries and draws the cards |
558
+ | The collection's own dynamic page (`/customers`) | A `collection` block: `cardComponentId`, `limit` (1 to 200), `order` (`newest` or `oldest`), `emptyText` |
559
+ | A component placed on several pages | A `table` prop filled per instance. The quotes are then copies: a change to one entry is repeated by hand on each instance |
560
+
561
+ Bound template (the section's own values; one card shown):
562
+
563
+ ```html
564
+ <p class="eyebrow" data-bcms-field="testimonials_eyebrow" data-bcms-kind="text">Customers</p>
565
+ <h2 class="text-3xl" data-bcms-field="testimonials_title" data-bcms-kind="text">Teams that stopped chasing spreadsheets</h2>
566
+ <div class="cards grid gap-6 md:grid-cols-3">
567
+ <figure class="t-card">
568
+ <div class="stars" role="img" aria-label="5 out of 5 stars">★★★★★</div>
569
+ <blockquote><p>&ldquo;We closed March in a day and a half. Our auditors asked what changed.&rdquo;</p></blockquote>
570
+ <figcaption><img class="avatar" src="/img/people/dana-ruiz.jpg" alt=""><span class="name">Dana Ruiz</span></figcaption>
571
+ </figure>
572
+ </div>
573
+ ```
574
+
575
+ - The cards carry no page binding. Their words belong to the entries and are edited there, once,
576
+ for every page that shows them. The picked list is changed in the side panel.
577
+ - Draw the stars from `rating`; never store the glyphs.
578
+
579
+ Not available today: a component prop that references entries (there is no reference prop type; it
580
+ would save and render nothing). A listing chosen by tag or filter on a route the repo's code
581
+ renders: the `collection` block with `source`, `filters` and `sort` is drawn by the hosted
582
+ renderer only, so there a "latest for this product" list is a query in the site's code. A
583
+ decorative flag on an image VALUE: an empty `altText` is the signal for one placement;
584
+ `update_media` `decorative: true` marks the asset itself.
585
+
586
+ ## 5. FAQ accordion with FAQPage markup
587
+
588
+ Source: a help band built from `<details>`, with hand-written FAQPage JSON-LD beside it.
589
+
590
+ ```html
591
+ <section class="faq" id="faq">
592
+ <h2>Questions, answered</h2>
593
+ <p>Straight answers about billing, data and switching tools.</p>
594
+ <details class="faq-item" open>
595
+ <summary><h3>Can I cancel at any time?</h3><svg class="chevron" aria-hidden="true"/></summary>
596
+ <div class="faq-item__body"><p>Yes. Cancel from <strong>Settings &gt; Billing</strong> and you keep access until the end of the period.</p></div>
597
+ </details>
598
+ <details class="faq-item">
599
+ <summary><h3>Where is my data stored?</h3><svg class="chevron" aria-hidden="true"/></summary>
600
+ <div class="faq-item__body"><p>In the EU or the US, your choice at sign-up. Read the <a href="/security">security overview</a>.</p></div>
601
+ </details>
602
+ <details class="faq-item">
603
+ <summary><h3>How do I move from spreadsheets?</h3><svg class="chevron" aria-hidden="true"/></summary>
604
+ <div class="faq-item__body"><p>Most teams switch in an afternoon:</p>
605
+ <ol><li>Connect your bank.</li><li>Import last month's CSV.</li><li>Invite your team.</li></ol></div>
606
+ </details>
607
+ <p class="faq__more">Still stuck? <a href="/support">Talk to support</a></p>
608
+ </section>
609
+ <script type="application/ld+json">{"@context":"https://schema.org","@type":"FAQPage","mainEntity":[...]}</script>
610
+ ```
611
+
612
+ Reasoning:
613
+
614
+ 1. Repeated `<details>` with a question and an answer, specific to this page: a repeater in the
615
+ page's fields. Move to a collection only when the same questions repeat on several pages.
616
+ 2. The question is a plain string; the `<h3>` and the chevron belong to the template. The answer
617
+ carries bold text, a link and a list: rich text, narrowed to what answers use.
618
+ 3. `open` on the first item is behaviour. It stays in the template.
619
+ 4. "Talk to support" is a `button` field. "Still stuck?" is fixed template copy.
620
+ 5. Delete the hand-written `<script type="application/ld+json">` and set the page's schema type
621
+ instead. Name the row keys so they contain `question` and `answer`: the FAQPage builder finds
622
+ the first list on the page whose rows have both.
623
+
624
+ Schema:
625
+
626
+ ```json
627
+ [
628
+ { "key": "faq_title", "label": "Heading", "type": "text", "richText": false },
629
+ { "key": "faq_intro", "label": "Intro", "type": "text", "richText": false },
630
+ { "key": "faq_items", "label": "Questions", "type": "repeater",
631
+ "ui": { "preview": { "title": "faq_question" }, "itemLabel": "Question" },
632
+ "fields": [
633
+ { "key": "faq_question", "label": "Question", "type": "text", "richText": false, "required": true },
634
+ { "key": "faq_answer", "label": "Answer", "type": "richtext", "required": true,
635
+ "config": { "accept": ["p", "b", "i", "link", "ul", "ol"] } }
636
+ ] },
637
+ { "key": "faq_support", "label": "Support link", "type": "button" }
638
+ ]
639
+ ```
640
+
641
+ Value (`set_page_content` `data`; each answer is a Portable Text array, shown below):
642
+
643
+ ```jsonc
644
+ {
645
+ "faq_title": "Questions, answered",
646
+ "faq_intro": "Straight answers about billing, data and switching tools.",
647
+ "faq_items": { "repeatable": [
648
+ { "faq_question": "Can I cancel at any time?", "faq_answer": [ /* one paragraph, "Settings > Billing" marked strong */ ] },
649
+ { "faq_question": "Where is my data stored?", "faq_answer": [ /* array A */ ] },
650
+ { "faq_question": "How do I move from spreadsheets?", "faq_answer": [ /* array B */ ] }
651
+ ] },
652
+ "faq_support": { "label": "Talk to support", "href": "/support", "variant": "link" }
653
+ }
654
+ ```
655
+
656
+ Array A, a paragraph with a link:
657
+
658
+ <!-- pt-example -->
659
+ ```json
660
+ [
661
+ { "_type": "block", "_key": "a2p1", "style": "normal",
662
+ "markDefs": [{ "_type": "link", "_key": "a2l1", "href": "/security" }],
663
+ "children": [
664
+ { "_type": "span", "_key": "a2s1", "text": "In the EU or the US, your choice at sign-up. Read the ", "marks": [] },
665
+ { "_type": "span", "_key": "a2s2", "text": "security overview", "marks": ["a2l1"] },
666
+ { "_type": "span", "_key": "a2s3", "text": ".", "marks": [] }
667
+ ] }
668
+ ]
669
+ ```
670
+
671
+ Array B, a paragraph then a flat numbered list:
672
+
673
+ <!-- pt-example -->
674
+ ```json
675
+ [
676
+ { "_type": "block", "_key": "a3p1", "style": "normal", "markDefs": [],
677
+ "children": [{ "_type": "span", "_key": "a3s1", "text": "Most teams switch in an afternoon:", "marks": [] }] },
678
+ { "_type": "block", "_key": "a3i1", "style": "normal", "listItem": "number", "level": 1, "markDefs": [],
679
+ "children": [{ "_type": "span", "_key": "a3s2", "text": "Connect your bank.", "marks": [] }] },
680
+ { "_type": "block", "_key": "a3i2", "style": "normal", "listItem": "number", "level": 1, "markDefs": [],
681
+ "children": [{ "_type": "span", "_key": "a3s3", "text": "Import last month's CSV.", "marks": [] }] },
682
+ { "_type": "block", "_key": "a3i3", "style": "normal", "listItem": "number", "level": 1, "markDefs": [],
683
+ "children": [{ "_type": "span", "_key": "a3s4", "text": "Invite your team.", "marks": [] }] }
684
+ ]
685
+ ```
686
+
687
+ Structured data (`update_page`):
688
+
689
+ ```json
690
+ { "pageId": "<page id>", "schemaType": "FAQPage" }
691
+ ```
692
+
693
+ Bound template (second item):
694
+
695
+ ```html
696
+ <details class="faq-item">
697
+ <summary><h3 data-bcms-field="faq_items[1].faq_question" data-bcms-kind="text">Where is my data stored?</h3>
698
+ <svg class="chevron" aria-hidden="true"/></summary>
699
+ <div class="faq-item__body" data-bcms-field="faq_items[1].faq_answer" data-bcms-kind="richtext">
700
+ <p>In the EU or the US, your choice at sign-up. Read the <a href="/security">security overview</a>.</p>
701
+ </div>
702
+ </details>
703
+ ```
704
+
705
+ - The question binds on the `<h3>`, not the `<summary>`: a save on the summary would erase the
706
+ chevron.
707
+ - `.faq-item__body` renders nothing but the answer, so it is the answer's element. If it also held
708
+ a "Was this helpful?" row, wrap the answer in its own `<div>` and bind that.
709
+ - A paragraph inside an answer is addressed `faq_items[1].faq_answer#a2p1`; keep `_key` values
710
+ stable when you rewrite an answer, and write the whole field, never one block.
711
+
712
+ Not available today: FAQPage markup that appears on its own. Without `schemaType: "FAQPage"` the
713
+ page gets WebPage. An "open several at once" setting has no field type of its own; if editors
714
+ need it, add a `boolean` field and have the template read it.
715
+
716
+ ## Checks after any example
717
+
718
+ 1. Read back what you wrote: `get_page`, `get_component` or `get_layout`. A richtext value comes
719
+ back as an envelope, an image as the resolved asset, a repeater as `{ repeatable }`.
720
+ 2. `get_site_composition`: every placed component is published and no required prop is empty.
721
+ 3. After the next release, `get_binding_report` for the route: no unmatched path for the fields
722
+ you bound, and the mode you expect.
723
+ 4. Edit one value of each bound kind in the Visual Editor (a text, a link, an image, a body
724
+ block) and confirm only that element changed.
725
+ 5. Publishing needs the user's authorization. Say what is still a draft.