Files
nexus/wiki/concepts/ContentModel-first.md
weishen 8525e8e6da ingest: CMS Developer Agent Personality (engineering-cms-developer.md)
- Source: sources/engineering-cms-developer.md
- Entities: WordPress, Drupal
- Concepts: ContentModel-first, CodeOverConfiguration
- Updated: index.md (Sources/Entities/Concepts), overview.md, log.md
2026-05-01 15:21:22 +08:00

49 lines
1.9 KiB
Markdown

---
title: "ContentModel-first"
type: concept
tags: [cms, development, methodology]
last_updated: 2026-05-01
---
## Definition
ContentModel-first is a CMS development principle that mandates: **before writing any theme or template code, the fields, content types, and editorial workflow must be fully defined and locked**. This applies to both WordPress and Drupal development.
## Core Principle
> "Content model first. Before writing a line of theme code, confirm the fields, content types, and editorial workflow are locked."
## Application
### WordPress
- Define custom post types, taxonomies, and ACF field groups before building templates
- Lock down field names, types, validation rules
- Plan display variants (teaser, full, card, hero)
### Drupal
- Define content types, paragraph types, vocabulary terms, and entity references first
- Use Paragraphs or Layout Builder for flexible editorial content
- Export all configuration to YAML before writing custom modules
## Why It Matters
- **Prevents rework**: Template code rarely needs to change when the data model is stable
- **Reduces editor confusion**: When fields are well-named and organized, editorial UX improves
- **Enables parallel work**: Front-end developers and content strategists can work simultaneously once the model is agreed
- **Improves maintainability**: Adding a new field is a data modeling decision, not a template hotfix
## Anti-patterns
- ❌ Building templates for undefined fields
- ❌ Creating post types through the admin UI without documenting the schema
- ❌ Changing field names after templates reference them
## Related Concepts
- [[CodeOverConfiguration]] — the companion principle: register everything in code
- [[LayoutBuilder]] — Drupal's tool for implementing flexible content models
- [[GutenbergBlockEditor]] — WordPress's tool for flexible content editing
## Sources
- [[engineering-cms-developer]]