Skip to content

Build your first page type

A page type gives editors their own fields and gives the public site its own output. This guide adds a Service page type with a Price field to a starter-kit project, then adds a public widget to an application that uses Layout Builder. The starter kit’s published smoke test applies the Service steps to a new project and requests the page anonymously.

capell:make-blueprint currently writes only a name and label class, so this guide does not use it.

In app/Actions/SeedStarterSiteAction.php, add the page to the list:

['service', 'Brand Sprint', '/services/brand-sprint', 'service_title', 'service_summary'],

In the same file, choose its editor and starting values:

'admin' => ['configurator' => match ($key) {
'case-study' => 'CaseStudy',
'service' => 'Service',
default => 'Default',
}],
'meta' => match ($key) {
'case-study' => ['client' => 'Field Notes', 'year' => '2026'],
'service' => ['price' => 'From £4,000'],
default => [],
},

Add its text to lang/en/starter.php:

'service' => 'Service',
'price' => 'Price',
'service_title' => 'Brand Sprint',
'service_summary' => 'Two weeks to a clearer brand.',

Create app/Filament/Configurators/Pages/ServicePageConfigurator.php:

<?php
declare(strict_types=1);
namespace App\Filament\Configurators\Pages;
use Capell\Admin\Filament\Configurators\Pages\DefaultPageConfigurator;
use Filament\Forms\Components\TextInput;
use Filament\Schemas\Components\Section;
use Filament\Schemas\Schema;
use Override;
final class ServicePageConfigurator extends DefaultPageConfigurator
{
#[Override]
protected function getEditFormSchema(Schema $schema): array
{
return [
...parent::getEditFormSchema($schema),
Section::make(__('starter.service'))->schema([
TextInput::make('meta.price')->label(__('starter.price'))->required()->maxLength(50),
]),
];
}
}

Add this import to app/Providers/AppServiceProvider.php:

use App\Filament\Configurators\Pages\ServicePageConfigurator;

Then register the configurator in its boot() method, beside the case study configurator:

CapellAdmin::contributeToAdminSurface(AdminSurfaceContributionData::configurator(
class: ServicePageConfigurator::class, group: 'Pages', name: 'Service', owner: 'app',
));

Public Blade receives hydrated values and never queries models. In contribute() in app/Support/StudioRenderDataContributor.php, add:

'price' => $context->page->meta['price'] ?? '',

In resources/views/capell/themes/capell-app/studio/layout.blade.php, add this above the contact form condition:

@if($studio->kind === 'service')
<p class="price">{{ __('starter.price') }}: {{ $studio->price }}</p>
@endif

Setup is safe to repeat. It keeps edited content and creates what is missing.

Terminal window
composer run setup
php artisan serve

Open /services/brand-sprint. In Admin, open Pages, edit Brand Sprint, change Price and save. Reload the public page in a private window and confirm the new price.

Price above is a plain value in the page’s meta column, edited through a configurator. To add a field to an existing page type without replacing its editor, follow Add a custom field to a page, which adds Client name to a case study with a schema extender. Choose a custom-field approach compares configurators, schema extenders, metadata, typed properties, related models and component fields, with real extension examples.

The starter kit already includes a case-study page type with client and year fields. Inspect that implementation before adding a second client field.

A page type here is a blueprint on ordinary Page records. Registering a new model subject with BlueprintSubjectDescriptorData and BlueprintSubjectRegistry is a different, larger step that a website-specific field does not need.

Widgets need the Layout Builder package, which the guided installer adds and the starter kit does not include. On the starter kit, install it first:

Terminal window
composer require capell-app/layout-builder
php artisan capell:package-cache:clear
php artisan capell:extension-install capell-app/layout-builder

Three things connect a widget: a Blade component, a renderable registered under a key, and a widget record that names that key. The layout must also print its containers.

Create the Blade component resources/views/components/widgets/project-note.blade.php. The renderable’s blade value is a component name, so the file belongs under components:

<p class="project-note">Talk to us about a similar project.</p>

Add these imports to app/Providers/AppServiceProvider.php:

use Capell\Core\Data\RenderableDefinitionData;
use Capell\Core\Support\Renderables\RenderableRegistry;

Then register the renderable in its boot() method:

app(RenderableRegistry::class)->register(new RenderableDefinitionData(
key: 'project-note',
type: 'layout-widget',
blade: 'widgets.project-note',
));

The starter kit’s layout does not print containers yet. In resources/views/capell/themes/capell-app/studio/layout.blade.php, add this inside <main id="main">, before the <h1>:

<x-capell-layout-builder::layout.area :layout="$layout" :public-render-data="$publicRenderData" />

Create the widget record and place it in the main container of the starter’s studio layout:

Terminal window
php artisan tinker --execute='
$blueprint = Capell\Core\Models\Blueprint::firstOrCreate(["key" => "note", "type" => Capell\LayoutBuilder\Enums\LayoutTypeEnum::Widget->value], ["name" => "Note", "default" => true]);
$widget = Capell\LayoutBuilder\Models\Widget::firstOrCreate(["key" => "project-note"], ["name" => "Project note", "blueprint_id" => $blueprint->id, "status" => true]);
$widget->update(["component" => "project-note"]);
$layout = Capell\Core\Models\Layout::where("key", "studio")->first();
$containers = $layout->containers ?? [];
$placed = collect($containers["main"]["widgets"] ?? [])->contains(fn ($item) => ($item["widget_key"] ?? null) === "project-note");
if (! $placed) {
$containers["main"]["widgets"][] = ["widget_key" => "project-note"];
$layout->update(["containers" => $containers]);
}
'
php artisan cache:clear

Reload / and confirm the note appears above the page heading. The placement is safe to run again, because it adds the widget only when the layout does not already contain it. On a site that already has a layout with containers, change "studio" to your layout key and skip the layout edit.