Entities
Everything in Foir is an entity. Pages, blog posts, menus, product descriptions - they’re all entities with different types of content.
What is an Entity?
An entity is a piece of content with:
- Fields - The actual content (text, images, etc.)
- Variants - Different versions for different audiences
- Version history - Track changes and publish when ready
Entity Types
Your project comes with built-in entity types, and you can create custom ones:
Built-in Types
| Type | What it’s for |
|---|---|
| Page | Web pages with URL routing |
| Menu | Navigation menus |
| Template | Page layouts with content zones |
Custom Entity Types
Create your own entity types in Settings > Entity Types:
- Give it a name and key (e.g., “Blog Post” /
blog-post) - Add fields for your content
- Configure how it behaves
Fields
Each entity type has a schema that defines its fields:
Blog Post
├── Title (text, required)
├── Slug (text, required)
├── Featured Image (image)
├── Content (rich text)
├── Author (reference to user)
└── Published Date (date)See Field Types for all available types.
Variants
Every entity can have multiple variants for different audiences:
Homepage
├── Default variant
├── Mobile variant (simplified layout)
├── VIP variant (exclusive offers)
└── Holiday variant (seasonal content)Each variant has its own content and version history. See Variants for details.
Version History
Changes are saved as versions:
- Edit - Make changes (saved as draft)
- Preview - See how it looks
- Publish - Make it live
You can always go back to a previous version or schedule publishing for later.
Reusable Components
Some entity types can be embedded inside other entities. For example, create a “Hero Banner” type with heading, image, and button fields, then use it on any page.
See Inline Schemas for details.
Creating Entities
In the Admin UI
- Go to the content section (Pages, Blog Posts, etc.)
- Click Create New
- Fill in the fields
- Click Save Draft or Publish
Via API
mutation {
createEntity(input: {
modelKey: "blog-post"
naturalKey: "my-first-post"
content: {
title: "My First Post"
slug: "my-first-post"
content: "..."
}
}) {
id
}
}Next Steps
- Field Types - Learn about available fields
- Variants - Target different audiences
- Routing - Set up URLs for your content