Skip to content

Commit a1e0736

Browse files
committed
Make home page route enabling configurable.
1 parent 5e7eca1 commit a1e0736

File tree

5 files changed

+31
-2
lines changed

5 files changed

+31
-2
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -442,6 +442,8 @@ Register the package routes in your `web.php` file. Place this at the **bottom**
442442
\Statikbe\FilamentFlexibleContentBlockPages\Facades\FilamentFlexibleContentBlockPages::routes();
443443
```
444444

445+
If you want to implement a custom home page route, you can [configure this](./documentation/configuration.md#enable-home-page-route).
446+
445447
### Generating URLs
446448

447449
Use the facade to generate URLs for pages:

config/filament-flexible-content-block-pages.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,17 @@
192192
*/
193193
'route_helper' => \Statikbe\FilamentFlexibleContentBlockPages\Routes\LocalisedPageRouteHelper::class,
194194

195+
/*
196+
|--------------------------------------------------------------------------
197+
| Home route
198+
|--------------------------------------------------------------------------
199+
|
200+
| This package can provide a home page route where the page with code `HOME` is shown.
201+
| If you want to implement your own custom home page, you can disable this here.
202+
|
203+
*/
204+
'enable_home_route' => true,
205+
195206
/*
196207
|--------------------------------------------------------------------------
197208
| Theme

documentation/configuration.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,15 @@ For non-translatable routes, you can use:
211211
'route_helper' => \Statikbe\FilamentFlexibleContentBlockPages\Routes\PageRouteHelper::class,
212212
```
213213

214+
### Enable home page route
215+
216+
The package provides a home page route where the page with code `HOME` is rendered.
217+
If you want to implement your own custom home page, you can disable this:
218+
219+
```php
220+
'enable_home_route' => false,
221+
```
222+
214223
## Theme Configuration
215224

216225
Configure the theme for templates including pages, layouts, menus, and language switch components.

src/FilamentFlexibleContentBlockPagesConfig.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,11 @@ public function getRouteHelper(): HandlesPageRoutes
238238
return $this->routeHelper;
239239
}
240240

241+
public function isHomePageRouteEnabled(): bool
242+
{
243+
return $this->packageConfig('enable_home_route', true);
244+
}
245+
241246
public function getCustomPageTemplates(): array
242247
{
243248
return $this->packageConfig('page_templates', []);

src/Routes/AbstractPageRouteHelper.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,10 @@ public function definePageRoutes(): void
2727
->name(static::ROUTE_CHILD_PAGE);
2828
Route::get('{page}', [PageController::class, 'index'])
2929
->name(static::ROUTE_PAGE);
30-
Route::get('/', [PageController::class, 'homeIndex'])
31-
->name(static::ROUTE_HOME);
30+
if (FilamentFlexibleContentBlockPages::config()->isHomePageRouteEnabled()) {
31+
Route::get('/', [PageController::class, 'homeIndex'])
32+
->name(static::ROUTE_HOME);
33+
}
3234
}
3335

3436
public function defineSeoTagRoutes(): void

0 commit comments

Comments
 (0)