F
Filament7d ago
Adel

Custom pages SEO?

I am looking for best package that can add SEO tags in custom page? because I am using Filament as a full website and I tried https://github.com/ralphjsmit/laravel-filament-seo but it seems to be only working with models but what about custom pages?
GitHub
GitHub - ralphjsmit/laravel-filament-seo: A package to combine the ...
A package to combine the power of Laravel SEO and Filament Admin. - GitHub - ralphjsmit/laravel-filament-seo: A package to combine the power of Laravel SEO and Filament Admin.
6 Replies
awcodes
awcodes7d ago
Filament requires a logged in user. What doesn’t Seo have to do with filament. Just doesn’t make sense.
igorclauss
igorclauss6d ago
This is absolutely true. But you can remove the auth from the panel provider and can create public pages. In this case it can be a thing
Adel
AdelOP6d ago
Absolutely! Filament works great for guest users — you can take advantage of all its authentication features in no time. Plus, you’re free to use widgets however you like within the page view. Steps to do: 1. Create new panel ex. site 2. in SiteServiceProvider: a. remove Widgets\AccountWidget::class widget b. remove Authenticate::class middleware c. remove Dashboard::class page d. add the below functions to the panel chain
->id('site')
->path('/')
->login()
->registration()
->emailVerification(isRequired: false)
->profile()
->passwordReset()
->topNavigation()
->id('site')
->path('/')
->login()
->registration()
->emailVerification(isRequired: false)
->profile()
->passwordReset()
->topNavigation()
3. Create new Page HomePage and add it to SiteServiceProvider pages 4. add the below code to HomePage
class HomePage extends Page
{
protected static string $routePath = '/';

protected static ?string $slug = 'home';

protected ?string $heading = '';

protected static ?string $navigationIcon = 'heroicon-o-home';

protected static string $view = 'filament.site.pages.home-page';

public static function getRoutePath(): string
{
return static::$routePath;
}

public static function getNavigationLabel(): string
{
return __('Home');
}
}
class HomePage extends Page
{
protected static string $routePath = '/';

protected static ?string $slug = 'home';

protected ?string $heading = '';

protected static ?string $navigationIcon = 'heroicon-o-home';

protected static string $view = 'filament.site.pages.home-page';

public static function getRoutePath(): string
{
return static::$routePath;
}

public static function getNavigationLabel(): string
{
return __('Home');
}
}
5. create another Panel for user control panel ex. dashboard 6. add render hook to SitePanelProvider
->renderHook(PanelsRenderHook::GLOBAL_SEARCH_AFTER, fn (): View => view('filament.site.partials.global-search-after'))
->renderHook(PanelsRenderHook::GLOBAL_SEARCH_AFTER, fn (): View => view('filament.site.partials.global-search-after'))
content of global-search-after:
@guest
<x-filament::button
href="{{ route('filament.site.auth.login') }}"
tag="a"
outlined="true"
icon="heroicon-o-arrow-left-end-on-rectangle"
>
{{ __('Login') }}
</x-filament::button>
<x-filament::button
href="{{ route('filament.site.auth.register') }}"
tag="a"
icon="heroicon-o-user-plus"
>
{{ __('Join Us') }}
</x-filament::button>
@else
<x-filament::button
href="{{ route('filament.dashboard.pages.dashboard') }}"
tag="a"
icon="heroicon-o-cog-6-tooth"
:spa-mode="false"
:outlined="true"
>
{{ __('Dashboard') }}
</x-filament::button>
@endguest
@guest
<x-filament::button
href="{{ route('filament.site.auth.login') }}"
tag="a"
outlined="true"
icon="heroicon-o-arrow-left-end-on-rectangle"
>
{{ __('Login') }}
</x-filament::button>
<x-filament::button
href="{{ route('filament.site.auth.register') }}"
tag="a"
icon="heroicon-o-user-plus"
>
{{ __('Join Us') }}
</x-filament::button>
@else
<x-filament::button
href="{{ route('filament.dashboard.pages.dashboard') }}"
tag="a"
icon="heroicon-o-cog-6-tooth"
:spa-mode="false"
:outlined="true"
>
{{ __('Dashboard') }}
</x-filament::button>
@endguest
Adel
AdelOP6d ago
No description
Adel
AdelOP6d ago
No description
Adel
AdelOP6d ago
No description

Did you find this page helpful?