The Big Picture
| Part | Where | What it is |
|---|---|---|
| Collection | Admin > Collections (designer) | A content type: its fields, order, page size, public pages on or off |
| Item | Admin > Collections > name | One entry (one testimonial, one product), draft or published |
| Details collection | A collection marked "Details of" another | Child rows edited inside each item of the main collection (e.g. Variants of a Product) |
| List page | /c/<collection> | Published items, paginated |
| Details page | /c/<collection>/<item> | One item and its details rows |
| Embed code | Any page, theme page or layout | {{ collections:render collection="testimonials" limit="4" }} |
No files are needed: a new collection works at once with the built-in templates. A theme can give any collection its own look (step 5).
Who does what: only administrators design collections (create, change fields, delete). Managers and editors manage items according to the Collections row of Admin > Users > Roles & Permissions (view, edit, delete, publish).
Example: Testimonials
The list shows the author, a short blurb, the star rating and the date; clicking the blurb opens the details page with the rating and the full testimonial.
1. Create the collection
Admin > Collections > New Collection, right-hand column:
| Setting | Value |
|---|---|
| Name | Testimonials |
| Slug | testimonials (made from the name; pages at /c/testimonials; cannot change later) |
| Details of | - (a main collection) |
| Public pages | On |
| Title field | Author name (names items in lists and links; new items get their slug from it) |
| Order items by | Date, Descending |
| Items per list page | 12 |
2. Add the fields
Left-hand column, Add field for each one. The key is made from the label; it is how templates refer to the field and cannot change once saved (the label can).
| Label | Key | Type | Options |
|---|---|---|---|
| Author name | author_name | Text | Required, Show in admin list |
| Blurb | blurb | Text area | Max length 200 |
| Full testimonial | testimonial | Rich text | |
| Star rating | rating | Rating | Stars 5, Show in admin list |
| Date | date | Date |
Save. After saving, the designer shows the collection's embed code.
3. Add items
Admin > Collections, click Testimonials (or its list icon): the items grid. New Item opens the form built from your fields (Rich text uses the shared editor with the Media Manager). Set the status to Published and save. Without the publish permission, items are saved as drafts.
4. The pages already work
/c/testimonials: published testimonials, newest first, 12 per page (?page=2, ...)/c/testimonials/jane-doe: one testimonial. Drafts answer 404, except to signed-in staff who may view collections (previews).
5. Give them your own look (optional)
Add templates to the active theme. For each page, the first file found is used:
themes/<theme>/collections/testimonials/list.html(this collection only)themes/<theme>/collections/list.html(every collection, in this theme)- the same two files in
themes/starter/(the fallback theme) modules/collections/templates/list.html(built in)
The same goes for details.html and embed.html. Templates are wrapped in the theme's layout.html (except embeds, which go inside a page).
list.html: author, blurb (linking to the details page), stars and date.
<h1>{{ collection.name }}</h1>
{{#each items}}
<article class="testimonial">
<div class="stars" aria-label="{{ rating }} out of 5">{{ rating_stars }}</div>
<a href="{{ url }}" class="blurb">"{{ blurb }}"</a>
<p class="meta">{{ author_name }} · {{ date_formatted }}</p>
</article>
{{/each}}
{{#if pagination.show}}
{{#if pagination.prevUrl}}<a href="{{ pagination.prevUrl }}">← Newer</a>{{/if}}
{{#if pagination.nextUrl}}<a href="{{ pagination.nextUrl }}">Older →</a>{{/if}}
{{/if}}
details.html: stars and the full testimonial.
<article class="testimonial-full">
<div class="stars">{{ item.rating_stars }}</div>
{{{ item.testimonial }}}
<p class="meta">{{ item.author_name }} · {{ item.date_formatted }}</p>
<a href="{{ collection.url }}">← All testimonials</a>
</article>
Three braces ({{{ item.testimonial }}}) output Rich text and HTML fields unescaped: only staff write them, so they are trusted like the Rich HTML widget. Everything else uses two braces (escaped).
6. Embed 4 testimonials in a page
In the Pages editor, click Collection in the toolbar: choose Testimonials, 4 items and an order, and Insert adds the code at the cursor (editors can use it without access to Admin > Collections; the button is there while the Collections module is enabled). Or type it in any page, theme page or layout; the Embed Code column in Admin > Collections has it ready with a copy button, and its Used in column lists the pages and theme templates that embed each collection (deleting one that is used asks first):
{{ collections:render collection="testimonials" limit="4" }}
| Attribute | Meaning |
|---|---|
collection | Required: the collection's slug |
limit | How many items (default: the collection's page size; at most 50) |
sort | A field key or created_at / updated_at / sort_order; a leading - means descending: sort="-rating" |
template | Use embed-<name>.html instead of embed.html: template="cards" (falls back to embed.html) |
| any field key | Show only matching items: rating="5", featured="yes", category="Shoes" |
Put the code in a normal paragraph. Inside a code block (<pre>, <code>, e.g. pasted from an example box like the one above) it is shown as written, not run: that is how a page shows an embed code as an example. To turn such a box into a live embed, open the editor's Source code view (<>) and replace the <pre><code>...</code></pre> with <p>...</p>, or delete the box and use the Collection button. A paragraph holding only the code is replaced by the embed. Only published items are shown; unknown attributes are ignored. An embed template uses the same item values as the list page ({{#each items}}), without page heading or pagination. Pages that contain an embed are cleared from the page cache whenever an item or collection is saved.
The embed's output is finished HTML: shortcodes inside item fields (e.g. a widget code typed into a Rich text field) are not rendered.
Field Types
| Type | Admin input | In templates |
|---|---|---|
| Text | One line (max 255, or the field's max length) | {{ key }} |
| Text area | Several lines (max 5,000) | {{ key }} |
| Rich text | The shared WYSIWYG editor | {{{ key }}}, {{ key_excerpt }} (plain text, up to 200 characters, for lists) |
| HTML | Code text area (embeds, snippets) | {{{ key }}} |
| Number | Number with optional min / max | {{ key }} |
| Price | Number with cents | {{ key }}, {{ key_formatted }} ($19.50; symbol from Admin > Settings > Collections) |
| Rating | 1 to N stars (default 5) | {{ key }} (4), {{ key_stars }} (★★★★☆) |
| Date | Date picker | {{ key }} (2026-10-07), {{ key_formatted }} (Settings > General date format) |
| Yes/No | Switch | {{#if key}}...{{/if}} |
| Select | Dropdown of the choices you type (one per line) | {{ key }} |
| Image | Media Manager picker, or a /path or http(s) URL | <img src="{{ key }}" alt="{{ key_alt }}"> (key_alt: the image's alt text from the Media Manager, empty when it has none; in the built-in templates' loops, alt) |
| File | Media Manager picker | {{ key }} (URL), {{ key_name }} (file name) |
| Link | /path, http(s) URL or mailto: | <a href="{{ key }}"> |
| Relation | Pick an item of another collection | {{ key }} (its title), {{ key_url }}, {{ key_id }} |
Every item also has {{ title }}, {{ url }} (its details page; empty when the collection has no public pages), {{ slug }}, {{ id }}, and for the built-in templates' loops fields (label / type / display of the fields that have a value) and cells (every field in order, for table columns). The built-in list and embed templates show rich text as its excerpt and leave out the title field (it is already the heading). An extra value never replaces a real field: a field keyed rating_stars wins over the Rating extra.
Changing fields later
- Adding a field changes nothing in the database (values are stored as JSON); existing items show it empty.
- Renaming: change the label; the key stays.
- Changing the type is allowed within a group whose values stay valid: Text / Text area / Rich text / HTML / Link, or Number / Price / Rating. Otherwise remove the field and add a new one.
- Removing a field hides it from forms and templates. Its stored values are kept (re-adding the same key brings them back) unless you answer yes to "Also delete the values".
- Up to 50 fields per collection. Reserved keys:
id,slug,url,title,status,sort_order,created_at,updated_at,fields,cells,collection,details,children.
Example: Products with Their Own Pages
Every item of a collection with public pages has its own details page. The list page shows a card per product; clicking a card opens /c/products/<item> with everything about that product. The fields are the product's details: no second collection is needed.
1. Create the collection
| Setting | Value |
|---|---|
| Name | Products |
| Slug | products (pages at /c/products) |
| Details of | - (a main collection) |
| Public pages | On (this gives every product its own page) |
| Title field | Name (a product called "Blue Mug" gets the address /c/products/blue-mug) |
| Order items by | Name, Ascending |
| Items per list page | 12 |
2. Add the fields
Short fields for the list card, long ones for the product's page:
| Label | Key | Type | Used on |
|---|---|---|---|
| Name | name | Text (Required, Show in admin list) | List and page |
| Price | price | Price (Show in admin list) | List and page |
| Image | image | Image | List and page |
| Summary | summary | Text area (Max length 200) | List |
| Description | description | Rich text | Page |
| Specifications | specifications | Rich text | Page |
| Featured | featured | Yes/No | Embeds (featured="yes") |
Add a few products and publish them. /c/products and /c/products/blue-mug work at once with the built-in templates, which show every field that has a value.
3. The list: one card per product, linking to its page
themes/<theme>/collections/products/list.html. Inside {{#each items}} each product's fields are used directly, and {{ url }} is the address of its own page:
<h1>{{ collection.name }}</h1>
<div class="product-grid">
{{#each items}}
<a href="{{ url }}" class="product-card">
{{#if image}}<img src="{{ image }}" alt="{{ name }}">{{/if}}
<h2>{{ name }}</h2>
<p class="price">{{ price_formatted }}</p>
<p>{{ summary }}</p>
</a>
{{/each}}
</div>
{{#if pagination.nextUrl}}<a href="{{ pagination.nextUrl }}">More products →</a>{{/if}}
4. The product's own page
themes/<theme>/collections/products/details.html. Here the product is item, so its fields are {{ item.name }}, {{ item.price_formatted }} and so on:
<article class="product">
<a href="{{ collection.url }}">← All products</a>
{{#if item.image}}<img src="{{ item.image }}" alt="{{ item.name }}">{{/if}}
<h1>{{ item.name }}</h1>
<p class="price">{{ item.price_formatted }}</p>
{{{ item.description }}}
{{#if item.specifications}}
<h2>Specifications</h2>
{{{ item.specifications }}}
{{/if}}
</article>
Without these two files the built-in templates are used, so step 3 and 4 only change the look. Draft products answer 404 on their page, except to signed-in staff who may view collections (previews).
When a product needs more than fields
- Repeating rows belonging to one product (sizes, colours, spec lines): a details collection, shown on the same product page. See Master-Detail below.
- A link to a separate item that stands on its own and is shared (a brand, a designer): a Relation field pointing to that collection; on the page,
<a href="{{ item.brand_url }}">{{ item.brand }}</a>.
Master-Detail: Products with Variants
- Start from the Products collection of the example above.
- Create Variants with Details of: Products (fields: Size select S/M/L, Colour text, Stock number). Details collections have no pages of their own and cannot have details themselves (one level).
- Open a product: below its fields, a Variants table with Add row, move up/down and remove. The product and its rows are saved together in one request; nothing is saved if any row is invalid (the error names the row).
On the product's details page:
<h1>{{ item.name }}</h1>
<p>{{ item.price_formatted }}</p>
<table>
{{#each details}}
<tr><td>{{ size }}</td><td>{{ colour }}</td><td>{{ stock }}</td></tr>
{{/each}}
</table>
details holds the rows of the first details collection (by name); with several, use children.<slug> ({{#each children.variants}}) or loop over detailSets (each with collection, fields, items), as the built-in template does. Rows keep the order set in the form.
Featured products in any page: {{ collections:render collection="products" featured="yes" limit="4" }}.
Deleting
- Deleting an item deletes its details rows.
- Deleting a collection (administrators) deletes its details collections and all their items. Relations pointing to deleted items show nothing. When pages or theme templates embed the collection (the Used in column), the confirmation lists them, since those spots would then show nothing.
When to Write a Module Instead
Collections store and show content. Processes (orders and payments, stock that goes down on purchase, bookings that must not overlap), visitor submissions, nesting deeper than one level or very large, heavily filtered tables (hundreds of thousands of rows) belong in a module with code and real columns: see How to create a module.
For Developers
- Code:
modules/collections/(init.tsroutes, API and embed code;fields.tsfield types and checks;store.tsqueries;js/designer.js,js/items.jsadmin screens). - Tables:
collections(definition;fieldsis JSON,parent_idmarks a details collection) andcollection_items(dataJSON,parent_item_idfor details rows,status,sort_order). - The embed code uses the module shortcode hook (
AppModule.shortcodes, see the module guide); its pages are taggedcollectionsin the page cache. - Audit log actions:
collection.create/update/delete,collection_item.create/update/delete/publish/unpublish.