Skip to content

Commit 177b873

Browse files
committed
Improve docs + url helper
1 parent 4b39e75 commit 177b873

File tree

9 files changed

+1149
-21
lines changed

9 files changed

+1149
-21
lines changed

.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,3 +34,9 @@ testbench.yaml
3434
# Claude Code Instructions
3535
CLAUDE.md
3636
.claude
37+
38+
# TOC temp files:
39+
*.md.orig.*
40+
*.md.toc.*
41+
*/*.md.orig.*
42+
*/*.md.toc.*

README.md

Lines changed: 183 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ while providing content editors with an intuitive interface for managing pages a
1616
- **Flexible page management** - Create pages with hero images, flexible content blocks, SEO fields, and publication controls
1717
- **Hierarchical menu builder** - Drag-and-drop interface for creating navigation menus
1818
- **Multilingual support** - Full localization with automatic route generation for multiple languages
19-
- **SEO tools** - Automatic sitemap generation, meta tag management, and URL redirect handling when slugs change
19+
- **SEO tools** - Automatic sitemap generation, meta tag management, SEO tag pages, and URL redirect handling when slugs change
2020
- **Ready-to-use admin interface** - Pre-configured Filament panel with all resources and management tools
2121
- **Developer-friendly** - Extendable models & tables, customizable templates, and comprehensive configuration options
2222
- **Content organization** - Tag system, hierarchical page structure, and settings management
@@ -33,7 +33,57 @@ while providing content editors with an intuitive interface for managing pages a
3333

3434
## Table of contents
3535

36-
TODO
36+
<!--ts-->
37+
* [Installation](#installation)
38+
* [Laravel Filament Flexible Content Blocks](#laravel-filament-flexible-content-blocks)
39+
* [Laravel Localization](#laravel-localization)
40+
* [Laravel Tags](#laravel-tags)
41+
* [Setup in your project](#setup-in-your-project)
42+
* [Translations](#translations)
43+
* [Routes](#routes)
44+
* [Filament panel](#filament-panel)
45+
* [Schedule](#schedule)
46+
* [Page management](#page-management)
47+
* [Features](#features)
48+
* [Creating Pages](#creating-pages)
49+
* [Page Hierarchy](#page-hierarchy)
50+
* [Publication Controls](#publication-controls)
51+
* [Multilingual Support](#multilingual-support)
52+
* [Frontend Integration](#frontend-integration)
53+
* [Menu builder](#menu-builder)
54+
* [Features](#features-1)
55+
* [Adding a menu to Blade](#adding-a-menu-to-blade)
56+
* [Adding linkable models](#adding-linkable-models)
57+
* [Menu seeding](#menu-seeding)
58+
* [Settings](#settings)
59+
* [Use settings](#use-settings)
60+
* [Routing](#routing)
61+
* [URL Structure](#url-structure)
62+
* [Route Registration](#route-registration)
63+
* [Generating URLs](#generating-urls)
64+
* [Route Helpers](#route-helpers)
65+
* [Redirects](#redirects)
66+
* [Configuration](#configuration)
67+
* [Sitemap Generator](#sitemap-generator)
68+
* [Features](#features-2)
69+
* [Usage](#usage)
70+
* [Automatic Generation](#automatic-generation)
71+
* [Tags and SEO Tag Pages](#tags-and-seo-tag-pages)
72+
* [Authorisation](#authorisation)
73+
* [Configuration](#configuration-1)
74+
* [TODO's](#todos)
75+
* [Future work](#future-work)
76+
* [Development](#development)
77+
* [Changelog](#changelog)
78+
* [Contributing](#contributing)
79+
* [Security Vulnerabilities](#security-vulnerabilities)
80+
* [Credits](#credits)
81+
* [License](#license)
82+
83+
<!-- Created by https://github.com/ekalinin/github-markdown-toc -->
84+
<!-- Added by: sten, at: Tue Sep 9 23:28:54 CEST 2025 -->
85+
86+
<!--te-->
3787

3888
## Installation
3989

@@ -88,18 +138,21 @@ php artisan flexible-content-block-pages:seed
88138

89139
Further configure the [third-party packages that are used](#credits). Check the installation documentation of the following packages:
90140

91-
### [Laravel Filament Flexible Content Blocks](https://github.com/statikbe/laravel-filament-flexible-content-blocks)
141+
### Laravel Filament Flexible Content Blocks
92142

93143
Probably, you will want to tweak the configuration of the Flexible blocks package. Publish the configuration using [the
94144
installation guide](https://github.com/statikbe/laravel-filament-flexible-content-blocks?tab=readme-ov-file#installation).
95145

96-
### [Laravel Localization](https://github.com/mcamara/laravel-localization?tab=readme-ov-file#installation):
146+
### Laravel Localization
147+
148+
Follow [the installation](https://github.com/mcamara/laravel-localization?tab=readme-ov-file#installation)
149+
and make sure the middlewares are properly set up if you want to use localised routes.
97150

98-
Make sure the middlewares are properly set up if you want to use localised routes.
151+
### Laravel Tags
99152

100-
### [Laravel Tags](https://spatie.be/docs/laravel-tags/v4/installation-and-setup):
153+
Follow [the installation](https://spatie.be/docs/laravel-tags/v4/installation-and-setup)
154+
and publish the config and change the tag model to the package model:
101155

102-
Publish the config and change the tag model to the package model:
103156
```php
104157
[
105158
'tag_model' => \Statikbe\FilamentFlexibleContentBlockPages\Models\Tag::class,
@@ -157,6 +210,106 @@ Schedule::command('media-library:regenerate --only-missing')
157210
->dailyAt('4:20');
158211
```
159212

213+
## Page management
214+
215+
The package provides a comprehensive page management system built on flexible content blocks.
216+
217+
### Features
218+
219+
- **Flexible content creation** - Rich page editor with hero sections, flexible content blocks, and media integration
220+
- **Hierarchical organization** - Three-level page structure (parent → child → grandchild) with automatic URL generation
221+
- **Publication workflow** - Draft/published status with optional scheduling (`publishing_begins_at`/`publishing_ends_at`)
222+
- **Multilingual support** - Full translation support, including slug localization
223+
- **SEO optimization** - Built-in meta tags, Open Graph, Twitter cards, and structured data
224+
- **Author system** - Optional author assignment and attribution
225+
- **Media management** - Hero images, content images, and SEO images via [Spatie Media Library](https://github.com/spatie/laravel-medialibrary)
226+
- **Template system** - Custom page templates with fallback support
227+
- **Protected pages** - Undeletable flag for critical pages
228+
- **Search & filtering** - Full-text search across page content, ready for [Laravel Scout](https://laravel.com/docs/12.x/scout)
229+
230+
### Creating Pages
231+
232+
TODO screenshot
233+
234+
Create new pages through the Filament admin interface with a multi-tab form:
235+
236+
- **Content Tab** - Title, slug, intro, and flexible content blocks
237+
- **Hero Tab** - Hero image and call-to-action buttons
238+
- **Publication Tab** - Status, scheduling, and author assignment
239+
- **SEO Tab** - Meta tags, Open Graph, and Twitter card settings
240+
- **Parent Tab** - Page hierarchy and template selection (if enabled)
241+
242+
Pages use automatic slug generation from the title but can be manually overridden for custom URLs.
243+
244+
### Page Hierarchy
245+
246+
Create organized page structures with automatic URL generation:
247+
248+
```
249+
Homepage (/)
250+
├── About (/about)
251+
│ ├── Team (/about/team)
252+
│ └── History (/about/history)
253+
└── Services (/services)
254+
├── Web Development (/services/web-development)
255+
│ └── Laravel (/services/web-development/laravel)
256+
└── Consulting (/services/consulting)
257+
```
258+
259+
You can configure hierarchy support in your [configuration file](documentation/configuration.md#page-resource-configuration).
260+
In case you need deeper nesting, you can add extra routes.
261+
262+
### Publication Controls
263+
264+
Control page visibility with by setting publishing begin and end dates. So you can achieve the following statuses:
265+
266+
- **Draft** - Page exists but not visible to public users
267+
- **Published** - Page is live and accessible via URL
268+
- **Scheduled** - Automatically publish/unpublish at specific times
269+
270+
Use the `published()` scope in your queries to show only published content:
271+
272+
```php
273+
$pages = Page::published()->get();
274+
```
275+
276+
### Multilingual Support
277+
278+
When using the `LocalisedPageRouteHelper` ([see configuration](./documentation/configuration.md#route-helper)), pages automatically support multiple languages:
279+
280+
- **Translated content** - All text fields support per-locale content
281+
- **Localized URLs** - Each language gets its own slug (e.g., `/en/about`, `/nl/over-ons`)
282+
- **Content blocks** - Flexible content blocks are fully translatable
283+
- **SEO per language** - Meta tags and descriptions for each locale
284+
285+
The content can be copied between languages using the built-in "Copy to locales" action in the content blocks editor.
286+
287+
There is also a language switch component, that provides a simple way to navigate to another locale.
288+
For customisation, publish the views and if needed extend the [LanguageSwitch component](src/Components/LanguageSwitch.php).
289+
290+
### Frontend Integration
291+
292+
Generate URLs for pages in your Blade templates:
293+
294+
```php
295+
use Statikbe\FilamentFlexibleContentBlockPages\Facades\FilamentFlexibleContentBlockPages;
296+
297+
// Generate page URL
298+
$url = FilamentFlexibleContentBlockPages::getUrl($page);
299+
300+
// Generate URL for specific locale
301+
$url = FilamentFlexibleContentBlockPages::getUrl($page, 'en');
302+
303+
// OR there is a shorthand helper:
304+
flexiblePageUrl($page, 'nl');
305+
```
306+
307+
You can best publish the views and customise the styling and HTML structure to your project requirements.
308+
309+
For detailed frontend templating, theme customization, and available Blade components, see the [frontend documentation](documentation/frontend.md).
310+
311+
For advanced page customization, extending models, and custom workflows, see the [extending documentation](documentation/extending-and-customisation.md).
312+
160313
## Menu builder
161314

162315
The package includes a powerful hierarchical menu builder with a drag-and-drop interface for creating navigation menus. Menus support multiple types of links and can be easily styled with custom templates.
@@ -371,14 +524,19 @@ $schedule->command('flexible-content-block-pages:generate-sitemap')
371524
For advanced configuration options, generation methods, linkable models setup, and extending the sitemap generator service,
372525
see the [sitemap customisation documentation](documentation/extending-and-customisation.md#sitemap).
373526

527+
## Tags and SEO Tag Pages
528+
529+
TODO
530+
374531
## Authorisation
375532

376533
Authorisation setup is not included in this package. Most projects will use an authorisation strategy project-wide, e.g. via policies.
377534

378535
However authorisation can be easily implemented. There are two easy strategies:
379536

380-
1. Use the panel and implement a simple access rule for the panel on the user model in `canAccessPanel(Panel $panel)`
381-
2. Use a Filament authorisation library, like [Filament Shield](https://github.com/bezhanSalleh/filament-shield).
537+
1. Use the panel and implement a simple access rule for the panel on the user model in `canAccessPanel(Panel $panel)`.
538+
2. Remove the unwanted resources from the `resources` configuration.
539+
3. Use a Filament authorisation library, like [Filament Shield](https://github.com/bezhanSalleh/filament-shield).
382540
Shield can automatically generate policies with permissions that you can link to specific roles.
383541

384542
## Configuration
@@ -397,24 +555,30 @@ check:
397555
- Seppe: tailwind config complete? do we need to add flexible content blocks styling?
398556
- Seppe: menu components ok?
399557

400-
menu:
401-
- caching tree model + observer to clear cache
402-
- Menu titels menu items
403-
404-
page:
405-
- laravel scout
406-
407558
release:
408559
- policies:
409560
- note: undeletable pages
410561
- undeletable page toggle only for permission holder
411562
- documentation
412563
- Kristof: screenshots + banner + packagist + slack + filament plugin store
413564

414-
future:
415-
- A simple asset manager (include or not?)
416-
- Re-usable content blocks
565+
## Future work
566+
567+
- Caching of the menu data structure.
568+
- Add menu item for subtitle in menus.
569+
- A model to store re-usable content blocks, e.g. to create a marketing banner that can be reused on many pages, and edited once.
417570
- Contact form
571+
- FAQ model, resource and flexible blocks
572+
- A component to put on the pages with a quick link to edit this page in Filament
573+
- A trait for page indexing in Laravel Scout
574+
575+
## Development
576+
577+
To update all table of content sections in the documentation files, run:
578+
579+
```shell
580+
update_toc.sh
581+
```
418582

419583
## Changelog
420584

documentation/configuration.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,38 @@
22

33
In this document, we explain all settings available in the [filament-flexible-content-block-pages configuration file](../config/filament-flexible-content-block-pages.php).
44

5+
## Table of content
6+
7+
<!--ts-->
8+
* [Overview](#overview)
9+
* [Model Classes](#model-classes)
10+
* [Database Table Names](#database-table-names)
11+
* [Filament Resources](#filament-resources)
12+
* [Page Resource Configuration](#page-resource-configuration)
13+
* [Page Resource Options](#page-resource-options)
14+
* [CMS Panel Configuration](#cms-panel-configuration)
15+
* [Route Helper](#route-helper)
16+
* [Theme Configuration](#theme-configuration)
17+
* [Page Templates](#page-templates)
18+
* [Menu Builder Configuration](#menu-builder-configuration)
19+
* [Menu Configuration Options](#menu-configuration-options)
20+
* [Sitemap Configuration](#sitemap-configuration)
21+
* [Sitemap Generation Methods](#sitemap-generation-methods)
22+
* [Redirects Configuration](#redirects-configuration)
23+
* [Settings Configuration](#settings-configuration)
24+
* [Tags Configuration](#tags-configuration)
25+
* [Tag Pages Configuration](#tag-pages-configuration)
26+
* [Tag Pages Options](#tag-pages-options)
27+
* [Advanced Customization](#advanced-customization)
28+
* [Extending Models](#extending-models)
29+
* [Custom Route Helpers](#custom-route-helpers)
30+
* [Custom Menu Styles](#custom-menu-styles)
31+
32+
<!-- Created by https://github.com/ekalinin/github-markdown-toc -->
33+
<!-- Added by: sten, at: Tue Sep 9 23:28:54 CEST 2025 -->
34+
35+
<!--te-->
36+
537
## Overview
638

739
The Filament Flexible Content Block Pages package provides a comprehensive CMS system with flexible content blocks for Filament.

0 commit comments

Comments
 (0)