Skip to content

AfeaSoftware/filament-pages

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

afea/filament-pages

Custom pages module for the Afea Filament CMS package ecosystem.

Ships:

  • CustomPage model — rich content, SEO, optional table of contents, attachable form
  • Filament v4 CustomPageResource (form + table + pages)
  • PagesPlugin — register in your AdminPanelProvider
  • Public-facing routes registered per the configured routing strategy (slug / resource / localized)
  • PageController + overridable Blade views with sticky TOC sidebar
  • afea:install:pages — Laravel Prompts installer

Installation

composer require afea/filament-pages
php artisan afea:install:pages

Then in your AdminPanelProvider:

->plugin(\Afea\Cms\Pages\Filament\PagesPlugin::make())

The table of contents

Each page has an include_toc toggle. Enabling it:

  1. parses content for h2 and h3 tags,
  2. injects slugged id attributes onto each heading,
  3. renders a nested list in the shipped show view.

Override tags via afea-pages.toc.tags. Build your own UI with:

$toc = $page->toc();
$tree = $toc->tree();        // nested array of id/text/children
$html = $toc->html();         // content with ids injected

Three common scenarios

1. Switch routing strategy

Set AFEA_PAGES_ROUTING_STRATEGY=resource + AFEA_PAGES_PREFIX=pages — URLs move from /about to /pages/about. No data changes.

2. Override the CustomPage model

class CustomPage extends \Afea\Cms\Pages\Models\CustomPage
{
    public function scopePublished(Builder $q): Builder
    {
        return $q->active()->whereNotNull('system_name');
    }
}
'models' => ['custom_page' => \App\Models\CustomPage::class],

3. Render your own theme

php artisan vendor:publish --tag=afea-pages-views

Edit resources/views/vendor/afea-pages/show.blade.php. The template receives $page, $seo, $content (with TOC ids already injected) and $toc (nested array).

About

Afea Filament CMS — filament-pages

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors