Repository navigation
Description
Problem
The catalog advertises 8 post components as "in development" on /components. They exist in exactly one place — src/lib/site.ts:1194 — with no source, manifest, registry entry, docs, or demo twin. ROADMAP.md has tracked them since #123–#126 / #132–#135.
Before any of them gets written, we need to settle how post surfaces install, because the assumption baked into AGENTS.md doesn't survive contact with the target repo.
AGENTS.md currently specs them as "shadcn-native post components — file-only shadcn add, no Payload wiring." That is the weakest offer we could ship into the one tier where WordPress is strongest (>50% of WP core blocks are dynamic content blocks: Query Loop, post-*, comments, pagination). File-only components are pasted, not wired — which is the exact thing our positioning says we don't do.
The finding that reframes this
Two facts about payloadcms/payload/templates/website (our only supportedTargets entry, payload-website-starter):
-
The Posts collection has no blocks layout field. It has
title,heroImage,content(Lexical richText),relatedPosts,categories,meta,publishedAt,authors,slug. There is noname: 'layout'/type: 'blocks'array.Our entire
pagesLayoutfragment kind targets that field —support-matrix.jsonlistsname: 'layout'andtype: 'blocks'insrc/collections/Pages/index.tsas required anchors. There is nothing equivalent on Posts to patch. A "post block" in the page-block sense cannot exist in this target. -
The starter already ships an
archiveblock withpopulateBy(collection | selection),relationTo,categories,limit,selectedDocs. Any query block we ship lands next to an incumbent with a claimed slug.
So "build the 8 post components" isn't one piece of work — it's three different install routes, and most of the 8 aren't post components at all.
Reclassifying the 8
| Declared slug | What it actually is | Route |
|---|---|---|
post-archive |
a Page block that queries Posts | A |
post-list |
a Page block that queries Posts | A |
featured-post |
a Page block that queries Posts | A |
related-posts |
a Page block that queries Posts | A |
newsletter-callout |
a plain Page block, no query at all | A (ships today, no new work) |
post-card |
shared presentational primitive consumed by the above | shared file |
post-hero |
post template surface | C |
author-card |
post template surface | C |
Route A — Page-installed query blocks. Install onto Pages through the existing pagesLayout + renderBlocks fragments. Zero installer changes. Five of the eight land here.
Route B — Lexical inline blocks. Blocks inside the post body's richText. Needs a new fragment kind + anchor. Note the starter's src/fields/defaultLexical.ts registers no BlocksFeature — only Paragraph/Underline/Bold/Italic/Link — so the blocks list lives in the collection-level editor config, not the shared default. Anchor location unverified; treat as research.
Route C — Post template composition. Components composed into src/app/(frontend)/posts/[slug]/page.tsx. Not editor-managed. This is the file-only mode AGENTS.md describes — appropriate here, but it should be an explicit exception for two components, not the plan for all eight.
Decisions this issue needs to close
D1. Posts family = Page-installed query blocks (recommended).
Reclassify the 8 per the table. Ship Route A first; Route C as an explicit file-only exception; Route B deferred to its own issue. Update AGENTS.md — the blanket "post components are file-only" line becomes wrong the moment we do this.
D2. Slug collision with the starter's archive block.
Options: (a) distinct slugs (collectionQuery, postList) and leave archive alone — recommended, non-destructive, and our fragment dedup already keys on blockSlug; (b) position as a drop-in replacement, which means touching a block we didn't install. Pick (a).
D3. Target requirements when Posts doesn't exist.
support-matrix.json currently requires components.json, src/payload.config.ts, src/blocks/RenderBlocks.tsx, src/collections/Pages/index.ts. A query block additionally needs a Posts collection. Options:
- (a) add per-component required files/anchors to the manifest, so
addrefuses with a clear message anddoctorreports it — recommended - (b) generate a Posts collection on install — large blast radius, rejects our "reviewable diff" principle
- (c) document it as a prerequisite and fail at runtime — worst option
(a) means a manifest schema addition (requires / requiredAnchors) plus a checkRecordedComponent branch in commands/doctor.ts. Small, and it generalizes to every future data-driven block.
D4. Which collection can it query?
Starter's archive hardcodes relationTo: 'posts'. Do we hardcode, or make the collection selectable? Selectable is more useful and more work (needs the consumer's collection list at config time). Recommend: hardcode posts for v1, leave a note.
Scope
Ships in this issue:
collection-query— the wired Page block. Fields:populateBy(collection | selection),categories,limit,sort,selectedDocs,layout(grid | list | featured). Server component, realpayload.find, draft-aware.post-cardas a shared source file undersrc/blocks/shared/, consumed by the above.- Full bundle per
AGENTS.md: source + manifest + registry entry + docs + demo twin + installer test coverage. support-matrix.json/ manifest schema change from D3.AGENTS.mdcorrection from D1.
Follow-ups (separate issues, do not scope-creep here):
collection-pagination,collection-filters,collection-empty- Route B fragment kind for Lexical inline blocks
- Route C file-only
post-hero/author-card comments-thread(Payload ships no official comments plugin — genuine differentiator, but it needs a collection, moderation, and spam handling; it is not a component-sized problem)
Test contract impact — read before estimating
Every one of our 67 blocks is presentational. No block in payload-components/source/blocks/ reads from the database; the relationTo hits in existing configs are all media uploads. collection-query would be the first block whose content comes from a query at render time, and two green gates assume otherwise:
tests/int/demo-twins.int.spec.tsmirrorsclassNameliterals from source into the twin. A twin for a query-driven block has no fixed content to mirror — it needs fixture data, and the mirror rule needs a defined boundary (mirror the shell, not the rows?).tests/e2e/components-visual.e2e.spec.tssnapshots the twin per platform. Query output must be deterministic or the baseline flaps. Fixture data must be committed, not generated.
Also in scope to think about, not necessarily to solve: depth/population cost, draft vs published in live preview, and caching/revalidation on the consumer's page.
Catalog count pins: literal component counts are pinned in the fumadocs-site int spec and the frontend e2e spec, plus spelled-out prose. Adding a shipped component moves all of them. ROADMAP.md also still says 58 blocks; actual is 67.
Acceptance criteria
- D1–D4 decided and recorded in the issue thread
-
AGENTS.mdtwo-install-modes section corrected -
collection-queryships as a complete bundle (source, manifest, registry, docs, twin, tests) -
addrefuses cleanly on a target with no Posts collection, with an actionable message -
doctorreports the missing prerequisite rather than failing opaquely - Install is idempotent and recoverable after a partial run (existing state contract)
- Demo twin is deterministic from committed fixture data; visual baselines minted on both platforms
-
src/lib/site.tsentry moves from "in development" to shipped, withcommand/href/version - Count pins and
ROADMAP.mdupdated in the same change -
pnpm test:releasegreen
Open questions
- Is there a second
supportedTargetsshape we should admit here, or does this staypayload-website-starter-only? - Do we want
collection-queryto support the starter'sselectedDocsmanual-curation mode in v1, or collection-mode only? - Should the demo twin show a static three-card grid, or do we introduce a fixture-data concept to the twin system for all future data-driven blocks?
Activity