You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -169,6 +171,23 @@ The package includes a powerful hierarchical menu builder with a drag-and-drop i
169
171
-**Icon support** - Optional icons for menu items (basic implementation currently)
170
172
-**Dynamic labels** - Use model titles or custom labels for linked content
171
173
174
+
### Adding a menu to Blade
175
+
176
+
The package includes a `default` built-in menu style which is developed in a generic way so that you can tweak its styling by passing some attributes without having to publish the corresponding blade templates.
177
+
178
+
Example usage to have a horizontal menu using tailwind:
See the file `../tailwind/components/menu/default.blade.php` for all possible attributes.
190
+
172
191
### Adding linkable models
173
192
174
193
To make your models available in the menu builder, add them to the configuration:
@@ -204,63 +223,17 @@ class Product extends Model implements HasMenuLabel
204
223
If you are using the Flexible Content Blocks title trait in your model, you can implement `HasMenuLabel`
205
224
easily with [`HasTitleMenuLabelTrait`](src/Models/Concerns/HasTitleMenuLabelTrait.php).
206
225
207
-
### Using the 'default' menu style
208
-
209
-
The package includes a `default` built-in menu style which is developed in a generic way so that you can tweak its styling by passing some attributes without having to publish the corresponding blade templates.
210
-
211
-
Example usage to have a horizontal menu using tailwind:
The style can also be configured in the database model, then you can skip the `style` attribute.
255
-
256
226
### Menu seeding
257
227
258
228
It makes a lot of sense to create most of the menu's in seeders, so they can be automatically synced over different environments.
259
229
See the [menu seeding documentation](documentation/seeders.md) for programmatic menu creation.
260
230
231
+
For creating custom menu styles and advanced menu customization, see the [menu customization documentation](documentation/extending-and-customisation.md#menu).
232
+
261
233
## Settings
262
234
263
235
All settings are stored in one table in one record. The reason is to be able to add spatie medialibrary media as a config value.
236
+
Each setting is cached and refreshed when the settings change.
To add custom settings fields and extend the settings functionality, see the [settings extension documentation](documentation/extending-and-customisation.md#settings).
257
+
258
+
## Routing
259
+
260
+
The package provides a flexible routing system that supports hierarchical page structures and multilingual sites.
Register the package routes in your `web.php` file. Place this at the **bottom** of your routes file since page routes with slugs will catch many URLs:
286
272
287
-
1.**Create a migration** to add new columns:
288
273
```php
289
-
Schema::table(FilamentFlexibleContentBlockPages::config()->getSettingsTable(), function (Blueprint $table) {
290
-
$table->string('custom_field')->nullable();
291
-
$table->json('translatable_field')->nullable(); // for translatable fields
The package includes two route helper implementations:
302
+
303
+
-**`PageRouteHelper`**: For non-multilingual sites with simple URLs
304
+
-**`LocalisedPageRouteHelper`**: For multilingual sites with localized URLs (e.g., `/en/about`, `/nl/over-ons`)
305
+
306
+
Configure which helper to use in your [configuration file](documentation/configuration.md#route-helper).
307
+
308
+
For advanced routing customization, custom route helpers, and controller extensions, see the [routing customization documentation](documentation/extending-and-customisation.md#routes).
339
309
340
310
## Redirects
341
311
@@ -376,52 +346,11 @@ The package includes an automatic sitemap generator that creates XML sitemaps fo
376
346
-**Dynamic change frequency** - Based on last modification date (weekly, monthly, yearly)
To include your own models in the sitemap, ensure they implement [the `Linkable` contract and have a `getViewUrl()` method](https://github.com/statikbe/laravel-filament-flexible-content-blocks#linkable).
445
-
446
-
You will most likely already have added those models to the menu configuration's `linkable_models` array or
447
-
[call-to-actions models](https://github.com/statikbe/laravel-filament-flexible-content-blocks#linkable) then they will automatically be included in the sitemap.
448
-
449
-
If you do not want your model in menus or call-to-actions, you can extend the [SitemapGeneratorService](src/Services/SitemapGeneratorService.php).
450
-
451
-
### Extending the SitemapGeneratorService
452
-
453
-
For full customization power, you can create your own sitemap generator service by extending the base class or completely
454
-
implementing a new service by implementing [GeneratesSitemap](src/Services/Contracts/GeneratesSitemap.php):
455
-
456
-
```php
457
-
<?php
458
-
459
-
namespace App\Services;
460
-
461
-
use Statikbe\FilamentFlexibleContentBlockPages\Services\SitemapGeneratorService;
462
-
463
-
class CustomSitemapGeneratorService extends SitemapGeneratorService
464
-
{
465
-
protected function addCustomUrls(): void
466
-
{
467
-
parent::addCustomUrls();
468
-
469
-
// Add your custom logic
470
-
$this->addToSitemap(
471
-
url: 'https://example.com/dynamic-page',
472
-
lastModifiedAt: now(),
473
-
priority: 0.7,
474
-
frequency: 'weekly'
475
-
);
476
-
}
477
-
478
-
protected function getLinkableModels(): array
479
-
{
480
-
$models = parent::getLinkableModels();
481
-
482
-
// Add additional models not in menu/CTA config
483
-
$models[] = \App\Models\BlogPost::class;
484
-
$models[] = \App\Models\Event::class;
485
-
486
-
return $models;
487
-
}
488
-
489
-
protected function calculatePriority($page): float
490
-
{
491
-
// Custom priority logic
492
-
if ($page->is_featured) {
493
-
return 0.9;
494
-
}
495
-
496
-
return parent::calculatePriority($page);
497
-
}
498
-
}
499
-
```
500
-
501
-
Then update your configuration to use your custom service:
You can override any protected method to customize the sitemap generation behavior, including priority calculation, change frequency, URL filtering, or adding entirely new content types.
371
+
For advanced configuration options, generation methods, linkable models setup, and extending the sitemap generator service,
372
+
see the [sitemap customisation documentation](documentation/extending-and-customisation.md#sitemap).
512
373
513
374
## Authorisation
514
375
@@ -527,6 +388,8 @@ You can modify the published configuration file to match your application's requ
527
388
528
389
For detailed configuration options and examples, see the [configuration documentation](documentation/configuration.md).
529
390
391
+
If you want to further customise or extend the functionality, have a look [at the options](documentation/extending-and-customisation.md).
0 commit comments