Skip to content
HomePagesHomePages template kit

composePages

Lay the composed sections out across the artifact and hand back keyed page handles: the object key is the page id (stable identity: renaming a label must not move it) and object insertion order is artifact order — what nav menus and the editor's page bar render.

Lay the composed sections out across the artifact and hand back keyed page handles: the object key is the page id (stable identity: renaming a label must not move it) and object insertion order is artifact order — what nav menus and the editor’s page bar render. The handles are keyed rather than a bare array so later composition layers reference pages typed — renaming a page breaks the build, never the editor.

Import from @homepages/template-kit.

function composePages<T extends { [K in keyof T]: AuthoredPage; }>(pages: T): { readonly [K in keyof T]: T[K] & { readonly id: string; }; }
Name Type Required Description
pages T required

{ readonly [K in keyof T]: T[K] & { readonly id: string; }; }