LivePreviewUrlResolver
LivePreviewUrlResolver<
TDoc> =object["bivariantResolve"]
Defined in: packages/core/src/livePreview/types.ts:41
Resolves a document to the single public URL its live preview should render.
TDoc is supplied by the caller — AdminLivePreviewConfigInput instantiates it with
Partial<DocumentByCollectionSlug<...>> / Partial<DocumentByGlobalSlug<...>>, so a
resolver authored inside defineCollection/defineGlobal sees the exact generated
fields for its own collection/global — not a bare VexDocument.
Distinct from VexRouteMapper (routes/types.ts): routes.map answers “every
public path this document renders at” (0..N); this answers “the one URL to iframe
for preview” and may point at a different origin than production.
Type Parameters
Section titled “Type Parameters”TDoc extends Partial<VexDocument> = Partial<VexDocument>
doc
The document as currently known — saved fields merged with unsaved
form edits. Partial because a document being created has no _id yet.
Returns
Section titled “Returns”The URL to preview doc at, or undefined when it cannot be resolved yet.
Example
Section titled “Example”defineCollection({ slug: "pages", admin: { livePreview: { // doc: Partial<PagesDocument> — doc.slug is typed, not unknown url: (doc) => (doc.slug ? `https://example.com/${doc.slug}` : undefined), }, },});