Skip to main content
The <collection-item> tag allows you to display entries from a collection on your pages. Collections are reusable content sets (like testimonials, FAQs, features, etc.) that you can manage centrally and display dynamically.

Overview

Collections are perfect for:
  • Testimonials and reviews
  • FAQ sections
  • Feature lists
  • Team member profiles
  • Case studies
  • Product benefits
  • Any repeating content structure
The collection-item tag loops through all entries in a collection and displays them using your template.

Basic Usage

Simple Collection Display

With Styling

Attributes

Required Attributes

code

The collection code that identifies which collection to display. Format: Any string that matches your collection code Example:

Optional Attributes

id

Element ID applied to each collection entry wrapper. Example:

Collection Placeholders

Within the <collection-item> template, use {$field_name} to access collection entry fields.

Placeholder Format

Format: {$field_name} The $ prefix indicates this is a collection field placeholder.

Common Fields

Collection fields depend on how your collection is structured. Common examples include:
  • {$title} - Entry title
  • {$content} - Main content
  • {$description} - Description text
  • {$author} - Author name
  • {$image_url} - Image URL
  • {$name} - Name field
  • {$email} - Email field
  • {$rating} - Rating value
  • {$date} - Date field
Note: Available fields depend on your collection structure. Check your collection settings to see available fields.

Example with Multiple Fields

Complete Examples

Testimonials Collection

FAQ Collection

Features Collection

Team Members Collection

Styling Collections

CSS Grid Layout

Flexbox Layout

How It Works

  1. Collection Lookup: The system finds the collection by the code attribute
  2. Entry Retrieval: All entries from that collection are retrieved
  3. Template Rendering: For each entry, the template is rendered
  4. Placeholder Replacement: Collection placeholders ({$field_name}) are replaced with entry data
  5. Output: Each entry is wrapped in a <div> with the specified id (if provided)

Managing Collections

Collections are managed in your dashboard:
  1. Create Collection: Go to Collections → Create Collection
  2. Define Fields: Set up the fields your collection entries will have
  3. Add Entries: Add individual entries to your collection
  4. Use Code: Use the collection code in your <collection-item> tags

Collection Structure

When creating a collection, you define:
  • Collection Code: The identifier used in code="..." attribute
  • Fields: Custom fields for each entry (title, content, image, etc.)
  • Entries: Individual items in the collection

Best Practices

Content Organization

  • Logical Grouping: Group related content into collections
  • Consistent Structure: Keep entry fields consistent within a collection
  • Reusable Content: Use collections for content you’ll display in multiple places

Template Design

  • Responsive: Design templates that work on all devices
  • Consistent Styling: Keep styling consistent across entries
  • Flexible Layout: Design templates that work with varying content lengths

Performance

  • Limit Entries: Don’t create collections with hundreds of entries if you only need a few
  • Optimize Images: Ensure collection images are optimized
  • Cache Considerations: Collections are rendered server-side for performance

Troubleshooting

No Entries Displaying

Possible Causes:
  • Collection code doesn’t exist
  • Collection has no entries
  • Collection code is misspelled
Solutions:
  • Verify the collection code in your dashboard
  • Check that the collection has entries
  • Ensure the code attribute matches exactly (case-sensitive)

Placeholders Not Replacing

Issue: Placeholders show as literal text (e.g., {$title}) Solutions:
  • Check placeholder spelling (case-sensitive)
  • Ensure you’re using {$field_name} format with $ prefix
  • Verify the field exists in your collection structure
  • Check that entries have values for those fields

Missing Fields

Issue: Some fields are empty Solutions:
  • Verify the field name matches your collection structure
  • Check that entries have values for those fields
  • Ensure field names are spelled correctly (case-sensitive)