Skip to content

Commit 4c81b00

Browse files
committed
Add toggle for has SEO tag pages to tag type resource.
Fix bug in sitemap generator for linkable models Update documentation
1 parent a1e0736 commit 4c81b00

File tree

7 files changed

+19
-1
lines changed

7 files changed

+19
-1
lines changed

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,12 @@ If you want translated content and routes, go through the following steps:
177177
1. Configure the `supported_locales` in [the Filament Flexible Content Blocks configuration or in a service provider](https://github.com/statikbe/laravel-filament-flexible-content-blocks/blob/main/documentation/configuration.md#supported-locales)
178178
2. Configure the `route_helper` in [`filament-flexible-content-block-pages.php`](./config/filament-flexible-content-block-pages.php)
179179

180+
If you want to translate the labels, please publish the translation files:
181+
182+
```bash
183+
php artisan vendor:publish --tag="filament-flexible-content-block-pages-translations"
184+
```
185+
180186
### Routes
181187

182188
Register the routes in your route file, probably `web.php`.

resources/lang/en/filament-flexible-content-block-pages.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@
7474
'tag_type_plural_lbl' => 'tag types',
7575
'tag_type_lbl' => 'tag type',
7676
'tag_type_is_default_type_lbl' => 'Is default tag type',
77+
'tag_type_has_seo_pages_lbl' => 'Generate tag pages for SEO',
7778
'table' => [
7879
'created_at_col' => 'Created at',
7980
'updated_at_col' => 'Updated at',

resources/lang/fr/filament-flexible-content-block-pages.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@
7474
'tag_type_plural_lbl' => 'types de tags',
7575
'tag_type_lbl' => 'type de tag',
7676
'tag_type_is_default_type_lbl' => 'Type de tag par défaut',
77+
'tag_type_has_seo_pages_lbl' => 'Générer des pages de tags pour le SEO',
7778
'table' => [
7879
'created_at_col' => 'Créé le',
7980
'updated_at_col' => 'Modifié le',

resources/lang/nl/filament-flexible-content-block-pages.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@
7474
'tag_type_plural_lbl' => 'tagtypes',
7575
'tag_type_lbl' => 'tagtype',
7676
'tag_type_is_default_type_lbl' => 'Is standaard tagtype',
77+
'tag_type_has_seo_pages_lbl' => 'Genereer tag-pagina\'s voor SEO',
7778
'table' => [
7879
'created_at_col' => 'Aangemaakt op',
7980
'updated_at_col' => 'Aangepast op',

src/Commands/GenerateSitemapCommand.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,9 @@ public function handle(): int
4242

4343
$this->info('Sitemap generated successfully at: '.public_path('sitemap.xml'));
4444
} catch (\Exception $e) {
45+
report($e);
4546
$this->error('Failed to generate sitemap: '.$e->getMessage());
47+
$this->error($e->getTraceAsString(), 1);
4648

4749
return Command::FAILURE;
4850
}

src/Resources/TagTypeResource.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,9 @@ public static function form(Form $form): Form
8282
Toggle::make('is_default_type')
8383
->label(flexiblePagesTrans('tag_types.tag_type_is_default_type_lbl'))
8484
->default(false),
85+
Toggle::make('has_seo_pages')
86+
->label(flexiblePagesTrans('tag_types.tag_type_has_seo_pages_lbl'))
87+
->default(false),
8588
ColorPicker::make('colour')
8689
->label(flexiblePagesTrans('form_component.colour_lbl'))
8790
->regex('/^#([a-fA-F0-9]{6}|[a-fA-F0-9]{3})\b$/')

src/Services/SitemapGeneratorService.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,11 @@ protected function addSeoTagPages(): void
208208

209209
protected function getLinkableModels(): array
210210
{
211-
$ctaModels = FilamentFlexibleBlocksConfig::getCallToActionModels(CallToActionBlock::class);
211+
$ctaModels = collect(FilamentFlexibleBlocksConfig::getCallToActionModels(CallToActionBlock::class))
212+
->map(function (array|string $model) {
213+
return is_array($model) ? $model['model'] : $model;
214+
})
215+
->toArray();
212216
$menuModels = FilamentFlexibleContentBlockPages::config()->getMenuLinkableModels();
213217

214218
// Merge and remove duplicates

0 commit comments

Comments
 (0)