Nocean
Engineering

How to Manage Content with Fixtures

Learn how to manage blog content programmatically using TypeScript fixtures, version control, and the hybrid workflow approach.

N
Nocean Team
1 min read
content-managementfixturesdeveloper-tools
How to Manage Content with Fixtures

Managing Content Programmatically

This post demonstrates how to create blog content as TypeScript fixtures, giving you full version control and programmatic access to your content.

Why Use Content Fixtures?

Content fixtures provide several advantages for developer-centric teams:

  • Version Control: Track content changes in Git alongside code
  • Code Review: Review content updates through pull requests
  • Testing: Create test content for development environments
  • Consistency: Ensure staging and production stay in sync
  • Automation: Programmatically generate or update content

How It Works

The content management system provides three main operations:

1. Sync (Fixtures → Database)

Push your fixtures to the database:

pnpm content:sync

2. Export (Database → Fixtures)

Save database content as fixtures:

pnpm content:export

3. Check (Validate Consistency)

Verify fixtures match database:

pnpm content:check

Hybrid Workflow

You can mix both approaches:

  1. Legal pages (privacy, terms): Manage as fixtures
  2. Feature pages: Manage as fixtures
  3. Blog posts: Create in admin UI, then export to fixtures periodically
  4. Marketing pages: Use admin UI for quick updates

Example Fixture

Fixtures are written in TypeScript with full type safety. Here's a snippet:

export const examplePost = {
  slug: 'example-post',
  title: 'Example Post Title',
  content: '...',
  meta: {
    title: 'SEO Title',
    description: 'SEO description',
  },
}

Next Steps

Ready to try it? Check out the documentation to learn more about managing your content programmatically.