Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions server/handlers/cms/data/preview.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,9 @@ export async function handleRowPreview(
return jsonResponse({ error: 'No entry template found for this collection' }, { status: 404 })
}
const merged = composeTemplateChain(chain, { kind: 'entry' })
// The template chain has no Page for the entry, so composeTemplateChain
// can't know its title — the entry's own (draft) title is the real document title.
if (typeof draftCells.title === 'string') merged.title = draftCells.title

// Build a synthetic PublishedDataRow with the draft cells merged in.
// Bindings inside the template (`{currentEntry.body}`, featured-media
Expand Down
3 changes: 3 additions & 0 deletions server/publish/publicRenderer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,9 @@ export async function renderPublishedDataRowTemplate(
const chain = resolveTemplateChain(snapshot.site, { kind: 'entry', tableSlug: row.tableSlug })
if (chain.length === 0) return null // no entry template → 404 (unchanged behaviour)
const merged = composeTemplateChain(chain, { kind: 'entry' })
// The template chain has no Page for the entry, so composeTemplateChain
// can't know its title — the entry's own title is the real document title.
if (typeof row.cells.title === 'string') merged.title = row.cells.title

// Seed the entry stack with the published row + route frame from the request
// URL. Loop interceptors push/pop iteration items on top of this stack;
Expand Down
6 changes: 5 additions & 1 deletion src/core/templates/templateCompose.ts
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,11 @@ export function composeTemplateChain(chain: Page[], terminal: TerminalContent):
return {
id: innermost.id, // identifies "what was rendered" for the publish.html filter
slug: innermost.slug,
title: innermost.title,
// The terminal page's own title is the document's real title — the
// wrapping template's title is chrome, never `<title>` content. Entry
// terminals have no Page here; their caller overrides `title` from the
// published row after composing.
title: terminal.kind === 'page' ? terminal.page.title : innermost.title,
rootNodeId: acc.rootId,
nodes: acc.nodes,
}
Expand Down
Loading