Skip to content

Content modeling in a CMS — relationships, references, and the schema you regret later

A practical guide to modeling content types and relationships in a CMS so the schema survives growth — one-to-many, many-to-many, polymorphic, and what each costs.

A team launches a marketing site with three content types — page, post, author. Six months later there are events, case studies, team members, locations, and a partner directory. The page model has eleven loose text fields that used to be unused but now hold critical taxonomy data. Authors are sometimes content authors and sometimes “people we feature in case studies” and sometimes both with different bios. Search is broken because tags live as a freetext field. This article is the modeling discipline that prevents that schema rot, and the relationship patterns that survive the next eighteen months.

How to verify

A well-modeled CMS has these signs in the schema and the queries:

# A query for "posts by author X" should be one indexed lookup, not a freetext scan
# In Directus, Strapi, Payload, etc., a relation field generates a join table
# Confirm the join exists:
psql -h db -U cms -d cms -c "\d+ posts_authors"
# Table "public.posts_authors"
#  posts_id     | uuid | not null
#  authors_id   | uuid | not null
# Indexes: PRIMARY KEY (posts_id, authors_id), INDEX (authors_id)

# A taxonomy ("category", "tag") should be its own content type, not a text field
# If you see:
SELECT DISTINCT tag FROM posts WHERE tag IS NOT NULL;
# returning 47 variants of "DevOps", "dev-ops", "devops", "Dev Ops"
# the schema is wrong, the value is the data, and migration is in your future

# A polymorphic relation (one field pointing at multiple content types)
# should show a discriminator column or a junction table per target:
\d+ blocks
# block_type | varchar  (the discriminator: "hero", "callout", "image_grid")

If “posts by author X” requires a freetext LIKE '%alice%' scan, the schema has freetext where it should have a relation. If categories are duplicated forty-seven ways, the schema lacks the canonical taxonomy. Both are fixable; both get more expensive every week.

What’s happening

Content modeling is database modeling with a marketing-team UX layer on top. The same rules apply: normalize what should be normalized, denormalize where the read pattern justifies it, use the right relationship type for the data, and don’t put structured data in freetext fields. The CMS gives you primitives — text, number, boolean, date, file, relation, repeater, JSON — and your job is to assemble them into the smallest schema that captures the business.

There are four relationship shapes every CMS supports under different names. One-to-one (a page has one SEO config). One-to-many (an author has many posts; a post has one author). Many-to-many (a post has many tags; a tag has many posts). Polymorphic (a page contains a sequence of blocks, where each block can be a Hero, an Image, a Callout, etc., stored in the same parent collection).

The instinct of less-experienced modelers is to flatten everything into one big content type — “Page” with 60 fields, half of them used per template. The instinct of over-trained database people is to model every nuance as a separate collection. The right answer sits between: a content type per concept the editors actually distinguish in their heads, relations between them, and a polymorphic block model for the freeform page-building part.

The procedure

  1. List the nouns the editors use. Sit with the author team for thirty minutes. Write down every distinct word they use for “content” — page, post, news, event, case study, person, partner, location, product, FAQ, testimonial. Each one is a candidate content type. Merge synonyms (news = post = article). Mark the ones that have a distinct admin workflow (an event has a date and venue; a post does not).

  2. Decide the relationships between them. Draw a diagram on paper. Lines with arrows. Author → writes → Post (one author per post). Post → tagged → Tag (many tags per post, many posts per tag). Event → at → Location (one location per event). Case Study → features → Person (many people per case study). Each line is a relation field; each arrow direction is the side that “owns” the relation in the CMS UI.

  3. Pick the right relation type in the CMS. In Directus, that’s M2O, O2M, M2M, M2A. In Strapi, that’s relation field with oneToOne/oneToMany/manyToMany/manyToOne/morphTo. In Payload, it’s relationship with hasMany: true|false and relationTo: 'collection-slug'. The naming differs; the shape is the same.

  4. Model taxonomies as content types, not text fields. “Category” and “Tag” are content types with their own admin pages, slugs, and SEO metadata. The post → category relation is a M2O (one category per post) or M2M (many categories per post) depending on the design. The cost of “tag is just a text field” is paid in every search, every filter, every report — and in the cleanup migration when someone notices “DevOps” and “devops” are not the same.

  5. Use polymorphic blocks for flexible page layouts. A modern marketing page is a sequence of sections: hero, feature grid, image-with-text, testimonial, CTA, FAQ. The natural model is a Page collection with a blocks field that is an ordered list of objects, where each object is a different shape. In Payload, that’s blocks: [HeroBlock, FeatureGridBlock, ...]. In Sanity, that’s an array of objects. In Directus, that’s an M2A relation with multiple target collections. The result: marketers compose pages from a fixed palette, the frontend renders each block type with a dedicated component, and adding a new block type is a schema change instead of a code change.

  6. Add a slug field on every content type that ships to a URL. Auto-generated from title with override capability. Validate uniqueness. The frontend uses the slug for routing; the CMS API exposes it; SEO redirects when slugs change.

  7. Add an updatedAt and status field on every content type. status: draft | published | archived is the editorial workflow. updatedAt powers staleness reports and “what changed since last build?” webhooks. Skip these and you find yourself adding them in a panicked migration when content review becomes a process.

Common pitfalls

  1. Repeater fields used as a substitute for relations. A Page with a repeater of “Author info” (name, photo, bio) duplicates author data on every page they appear. When the author changes their bio, every page is stale. Use a Person content type and a relation.

  2. Polymorphic blocks abused for everything. Not every list of items is a block. A Post with a tags field that is a polymorphic relation pointing at four different content types is over-engineered. Use a regular M2M to a Tag content type.

  3. Pages and posts merged into one content type. A Content collection with a content_type: page | post | event discriminator field is a database-modeler’s idea of clean. It is not. Pages and posts have different fields, different admin workflows, different SEO patterns, and different URL structures. Separate them.

  4. Relation directions wrong. In a “post has one author” model, the relation field belongs on Post pointing at Author, not on Author listing posts. The UI hint: authors edit posts more than they edit author records. Putting the field where the editing happens is the right call.

  5. No “global settings” content type. Site name, footer text, default OG image, contact email — these are content, they change, and they should be a SiteSettings singleton. Hardcoding them in the frontend means a deploy every time marketing wants a new footer.

Operational notes

A schema migration in a coupled CMS (WordPress, Drupal) is wp-cli or drush and a backup. A schema migration in a headless CMS (Directus, Strapi, Payload) is a code change committed to git, applied through the CMS’s migration runner, and validated against a staging copy of production data. Both shapes survive bad migrations only if there is a backup and a rehearsal. Test schema changes against a production snapshot before applying them to production. Always.

We operate CMS-driven sites — coupled, headless, and hybrid — and the schema is the operating contract. We do the modeling interview, propose the relationships, and operate the result. See Managed Cloud Operations.