Skip to main content
The Content type represents published content items with compiled BindJS code ready for rendering.

Type Definition

type Content {
  id: ID!
  typeId: ID!
  packageVersion: String!
  name: String!
  description: String!
  content: String!
  compiled: String!
  tags: [String!]!
  locale: String
  createdAt: DateTime!
  updatedAt: DateTime!

  # Relationships
  contentType: ContentType!

  # Package resolution
  resolved: ResolvedPackage!
  resolvedRef: ResolvedPackageRef!
}

Fields

FieldTypeDescription
idID!Unique identifier
typeIdID!Content type ID
packageVersionString!Package version for component resolution
nameString!Content name
descriptionString!Content description
contentString!JSON content structure
compiledString!Standalone BindJS code
tags[String!]!Content tags for categorization
localeStringContent locale (e.g., “en-US”)
contentTypeContentType!Related content type
resolvedResolvedPackage!Full package data with dependencies
resolvedRefResolvedPackageRef!Package IDs for normalized caching
createdAtDateTime!Creation timestamp
updatedAtDateTime!Last update timestamp

Field Details

content

The content field contains the JSON structure of the content data:
{
  "title": "Getting Started Guide",
  "body": "Welcome to Metabind...",
  "author": "John Doe",
  "publishDate": "2024-01-15T10:00:00Z"
}

compiled

The compiled field contains standalone BindJS code that can be executed directly:
const body = () => {
  return ArticleLayout({
    title: "Getting Started Guide",
    body: "Welcome to Metabind...",
    author: "John Doe"
  })
}

resolved vs resolvedRef

Choose based on your use case:
  • resolved: Full package data inline (simpler client implementation)
  • resolvedRef: IDs only for normalized caching (smaller payloads, efficient caching)

Example Queries

Basic Content

query GetContent($id: ID!) {
  content(id: $id) {
    id
    name
    description
    tags
    locale
    contentType {
      name
    }
  }
}

Content with Full Package Data

query GetContentResolved($id: ID!) {
  content(id: $id) {
    id
    name
    compiled
    contentType {
      name
      schema
    }
    resolved {
      package {
        id
        version
        components
        assets
      }
      dependencies {
        id
        version
        components
        assets
      }
    }
  }
}

Content with Caching References

query GetContentWithCaching($id: ID!) {
  content(id: $id) {
    id
    name
    compiled
    resolvedRef {
      package
      dependencies
    }
  }
}
Response:
{
  "data": {
    "content": {
      "id": "cont123",
      "name": "Getting Started",
      "compiled": "const body = () => { ... }",
      "resolvedRef": {
        "package": "abc123def456...",
        "dependencies": ["xyz789ghi012..."]
      }
    }
  }
}