Skip to content

Public Page API Internals

Capell public page data is resolved in Core so frontend rendering and API delivery do not drift.

Use Capell\Core\Actions\ResolvePublicPageByUrlAction to resolve a published page for a site, language, and URL.

The action returns Capell\Core\Data\PublicPageResolutionData:

  • page
  • site
  • language
  • layout
  • fields

fields contains the public page projection:

  • url
  • title
  • content
  • meta

The resolver applies public constraints: matching site and language URL, enabled non-redirect URL, accessible enabled type, publish dates, and a translation for the requested language. Revision IDs are only accepted when they belong to the same base page identity as the resolved URL.

Use Capell\ContentSections\Actions\BuildPublicLayoutGraphAction to extract Content Sections content without depending on the frontend package.

$graph = BuildPublicLayoutGraphAction::run(
layout: $layout,
page: $page,
language: $language,
containers: ['main'],
includeHtml: false,
);

Empty containers or ['*'] returns every layout container. Named containers return only those container keys.

Container filters are applied before element asset preload so ['main'] does not load unrelated sidebar/footer element assets.

The public page body renders only Content Sections containers in the main area. Missing meta.area values are treated as main for compatibility with older layouts.

Theme chrome can render named areas explicitly. Foundation Theme registers and renders header:

<x-capell::layout.area area="header" />

Area rendering uses the already-resolved layout containers and stored layout manager elements. Public Blade should not query for layouts, elements, pages, or media to render an area, and it must not expose authoring metadata.

Element payloads are resolved through Capell\ContentSections\Contracts\PublicElementPayloadResolver.

The default resolver returns:

  • title
  • content

and returns null for HTML.

Packages may contribute payloads through Capell\ContentSections\Contracts\PublicElementPayloadContributor::TAG when they need rendered element HTML or a richer public data shape. Keep contributors public-output focused; do not expose admin/editor-only metadata, raw model ids, or private asset references unless the package deliberately defines them as public API fields.