Setting up your dashboard0 entities found · 9/32 branches scanned
ID:WORK-268Status:done
entityRoutes config-rules adapter
The built-in adapter (in @refrakt-md/content) that turns site.entityRoutes into contributed pages: selects entities by type + filter, substitutes placeholders, renders an inline render string or a render-template partial per entity with $item bound, and back-fills sourceUrl.
type (comma-separated) + optional filter select entities via the shared parser (WORK-261)
{name} placeholder substitution from top-level + data fields; url per-segment encoded and site-root-relative (basePath applied, like a path-derived URL)
$item bound in render / render-template per the pinned contract; one page per matched entity; URL collisions error
Optional title feeds the page's frontmatter title (omitted → falls back to rendered H1); render-template resolved via the partial + file-roots machinery
Each matched entity's sourceUrl is back-filled with the generated route URL before the postProcess xref pass
Dependencies
WORK-267 (contributePages phase)
WORK-261 (shared field-match parser)
WORK-262 (deferred-body capture, for render templates)
packages/content/src/entity-routes.ts: createEntityRoutesHooks(resolvePartial) → a contributePages hook. Per rule: comma-split type, optional filter via the shared grammar; {name} substitution (per-segment-encode for url, plain for title/frontmatter); inline render or resolved render-template partial as content; binds $item = {id,type,url,data} via ContributedPage.variables; back-fills each matched entity's sourceUrl with the generated route (registry holds live objects, pre-aggregate, so xref sees it). render+render-template together → error; unresolved template → error.
packages/content/src/site.ts: added the __entity-routes__ hookset (resolves render-template partials via the partials map); renderContributed merges cp.variables into the page's transform variables so $item resolves in render.
basePath is applied to url by renderContributed (loader), per SPEC-069; title falls back to frontmatter/H1 when the rule omits it.
siteConfig is threaded via loadContentFromTree options; adapters/loadContent must pass the per-site config (with entityRoutes) for routes to generate — wired for the dogfood in WORK-272.