Skip to content

Collections

Collections represent dynamic content types that can have multiple entries, such as blog posts, services, team members, and products.

Stelo CMS supports various collection types:

Business offerings and service descriptions

  • Service name and description
  • Pricing information
  • Feature lists
  • Media galleries

Articles and news content

  • Article content with rich text
  • Publication dates
  • Categories and tags
  • Author attribution

Staff profiles and biographies

  • Photo and contact information
  • Role and department
  • Bio and expertise
  • Social media links

Client reviews and feedback

  • Client information
  • Review content
  • Ratings and recommendations
  • Project references

E-commerce catalog items

  • Product descriptions
  • Pricing and variants
  • Image galleries
  • Inventory tracking
model Collection {
id String @id @default(cuid())
type CollectionType
slug Json // Localized slugs
title Json // Localized titles
content Json // Localized rich content
excerpt Json? // Localized excerpts
metadata Json? // Type-specific metadata
published Boolean @default(false)
publishedAt DateTime?
featured Boolean @default(false)
sortOrder Int? // Manual ordering
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
authorId String?
author User? @relation(fields: [authorId], references: [id])
mediaFiles CollectionMedia[]
}
enum CollectionType {
SERVICE
BLOG_POST
TEAM_MEMBER
TESTIMONIAL
PRODUCT
PROJECT
FAQ
CUSTOM
}

Collections support type-specific metadata:

// Service-specific metadata
{
price: 1500,
duration: "2-3 weeks",
features: ["Feature 1", "Feature 2"],
category: "web-development"
}
// Team member metadata
{
position: "Senior Developer",
department: "Engineering",
email: "john@company.com",
social: {
linkedin: "https://linkedin.com/in/john",
twitter: "@johndoe"
}
}
// Product metadata
{
price: 99.99,
sku: "PROD-001",
inventory: 50,
variants: [
{ size: "small", color: "red", price: 89.99 },
{ size: "large", color: "blue", price: 109.99 }
]
}
const service = await trpc.collections.create.mutate({
type: "SERVICE",
title: {
en: "Web Development",
fr: "Développement Web"
},
content: {
en: {
body: "<p>Professional web development services...</p>",
excerpt: "Custom websites and applications"
},
fr: {
body: "<p>Services professionnels de développement web...</p>",
excerpt: "Sites web et applications sur mesure"
}
},
metadata: {
price: 2500,
duration: "4-6 weeks",
features: ["Responsive Design", "SEO Optimization", "CMS Integration"]
}
});
// Get all services
const services = await trpc.collections.getByType.query({
type: "SERVICE",
locale: "en",
published: true
});
// Get featured items
const featured = await trpc.collections.getFeatured.query({
limit: 6
});
// Search collections
const results = await trpc.collections.search.query({
query: "development",
types: ["SERVICE", "BLOG_POST"]
});

Collections can include multiple media files:

  • Featured Image: Primary visual representation
  • Gallery: Additional images or videos
  • Attachments: Documents and files
// Associate media with collection
await trpc.collections.addMedia.mutate({
collectionId: "collection_123",
mediaFileId: "media_456",
role: "featured" // featured, gallery, attachment
});

Collections support various sorting options:

  • Manual: Custom sort order
  • Chronological: By creation or publication date
  • Alphabetical: By title
  • Featured: Promoted items first

Collections provide the flexibility to create rich, dynamic content while maintaining the structure and consistency needed for professional websites.