ADR-0007: Nested Section Routing
Status: Accepted Date: 2026-03-29 Decision Makers: ghostmonk
Context
The existing routing system was flat — sections mapped 1:1 to top-level URL segments with a maximum depth of 2 (/section/item). Content types were encoded on sections, forcing every section to contain exactly one kind of content. This prevented:
- Deep organizational hierarchies (e.g.,
/creative-work/photography/portraits/beach-sunset) - Mixed content types within a single section
- Moving content between sections without breaking URLs
Decision
Replace flat routing with arbitrary-depth nested sections using:
- Materialized
pathfield on sections for O(1) URL resolution - Single
resolve-pathbackend endpoint that resolves any URL depth in one HTTP call - Content types on items, not sections — sections are display containers, items carry their own type
- Uniform
ListingIteminterface for display-type-agnostic rendering - Automatic 301 redirects when content or sections move
- Redirect flattening to prevent chains (A→B→C becomes A→C)
Consequences
Positive
- Unlimited URL depth for content organization
- Mixed content types per section (stories + projects in same section)
- Content can move between sections with URL preservation
- Simpler frontend — one endpoint call instead of multi-step resolution
- Breadcrumbs come free from the resolution endpoint
Negative
- Migration complexity — existing sections need
pathfield backfilled content_typeremoval from sections requires frontend guards during transition- Move operations cascade through subtrees (performance concern for deep trees)
- Two path formats for video assets (old flat, new with originals/) until fully migrated
Risks
- Deep recursive queries for subtree operations on large hierarchies
- Redirect table growth over time (needs periodic cleanup)