Skip to content

Building a Page

This guide walks you through creating a complete CMS page from scratch.

Create a Livewire component that extends JFA\FilamentCMSLivewire\Livewire\Page:

app/Livewire/Pages/About.php
namespace App\Livewire\Pages;
use JFA\FilamentCMSLivewire\Livewire\Page;
class About extends Page
{
public function __construct()
{
parent::__construct(
componentView: 'livewire.pages.about',
slug: 'about',
layout: 'layouts.app',
);
}
}
ArgumentPurpose
componentViewBlade view path for this page
slugMust match the database page slug
layoutLaravel layout view to use
{{-- resources/views/livewire/pages/about.blade.php --}}
<div class="wrapper py-20">
@include('filament-cms-livewire::partials.page')
</div>

The filament-cms-livewire::partials.page partial renders all sections dynamically. You can customize this or render sections manually.

If you need more control over layout:

{{-- resources/views/livewire/pages/about.blade.php --}}
<div>
{{-- Custom header --}}
<header class="bg-gray-900 text-white py-12">
<div class="container mx-auto px-4">
<h1>About Us</h1>
</div>
</header>
{{-- CMS sections --}}
<div class="wrapper py-20">
@include('filament-cms-livewire::partials.page')
</div>
{{-- Custom footer --}}
<footer class="bg-gray-100 py-8">
<div class="container mx-auto px-4">
<p>Contact us for more information.</p>
</div>
</footer>
</div>
routes/web.php
use App\Livewire\Pages\About;
Route::get('/about', About::class)->name('about');
  1. Go to /adminCMS → Pages
  2. Click Create
  3. Fill in:
    • Title: “About Us”
    • Slug: about (must match your component’s slug())
    • Route: about (should match your route name)
    • Status: Published

Create sections that will appear on this page:

  1. Go to CMS → Sections
  2. Create sections with slugs that match your Livewire components:
    • hero → renders App\Livewire\Hero
    • mission → renders App\Livewire\Mission
    • team → renders App\Livewire\Team
  1. Edit the “About Us” page
  2. Go to the Sections tab
  3. Click Attach Section
  4. Select your sections and set the order:
    • Hero: order 1
    • Mission: order 2
    • Team: order 3

Open http://your-app.test/about — your sections should render in order.

sequenceDiagram
    participant Browser
    participant Route
    participant Page
    participant DB
    participant Section
    
    Browser->>Route: GET /about
    Route->>Page: Mount About component
    Page->>DB: Find page by slug 'about'
    DB->>Page: Return page with sections
    Page->>Page: Resolve each section
    loop For each section
        Page->>Section: Instantiate Livewire component
        Section->>Section: mount(SectionContent)
        Section->>Section: hydrateFromContent()
    end
    Page->>Browser: Render HTML

The Page class automatically injects metatags from the CMS page record. Ensure your layout includes:

{{-- resources/views/layouts/app.blade.php --}}
<head>
<title>@yield('title', config('app.name'))</title>
@include('filament-cms-livewire::partials.head')
</head>

The filament-cms-livewire::partials.head partial renders:

  • <title> from page metatags
  • <meta name="description">
  • Open Graph tags
  • Twitter Card tags
app/Livewire/Pages/Services.php
namespace App\Livewire\Pages;
use JFA\FilamentCMSLivewire\Livewire\Page;
class Services extends Page
{
public function __construct()
{
parent::__construct(
componentView: 'livewire.pages.services',
slug: 'services',
layout: 'layouts.app',
);
}
}
{{-- resources/views/livewire/pages/services.blade.php --}}
<div>
@include('filament-cms-livewire::partials.page')
</div>
routes/web.php
use App\Livewire\Pages\Services;
Route::get('/services', Services::class)->name('services');
public function __construct()
{
parent::__construct(
componentView: 'livewire.pages.about',
slug: 'about',
layout: 'layouts.app',
);
}
<div class="about-page">
@include('filament-cms-livewire::partials.page')
</div>
public function __construct()
{
parent::__construct(
componentView: 'livewire.pages.about',
slug: 'about',
layout: auth()->check() ? 'layouts.app' : 'layouts.guest',
);
}
ProblemCauseSolution
Blank pageNo sections attachedAttach sections in admin
”Page not found”Wrong slugMatch slug in DB and component
Sections in wrong orderOrder columnReorder in admin
Component not foundMissing classCheck sections_class_path config