PHP code example of martin6363 / filament-smart-seo
1. Go to this page and download the library: Download martin6363/filament-smart-seo library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
martin6363 / filament-smart-seo example snippets
use Filament\Panel;
use Martin6363\FilamentSmartSeo\FilamentSmartSeoPlugin;
public function panel(Panel $panel): Panel
{
return $panel
->plugins([
FilamentSmartSeoPlugin::make(),
]);
}
use Illuminate\Database\Eloquent\Model;
use Martin6363\FilamentSmartSeo\Traits\HasSeo;
class Vehicle extends Model
{
use HasSeo;
}
use Filament\Forms\Components\RichEditor;
use Filament\Forms\Components\TextInput;
use Martin6363\FilamentSmartSeo\Forms\Components\SeoSection;
TextInput::make('title')->
use Filament\Forms\Components\RichEditor;
use Filament\Forms\Components\TextInput;
use Filament\Schemas\Components\Tabs;
use Filament\Schemas\Components\Tabs\Tab;
use Martin6363\FilamentSmartSeo\Forms\Components\SeoSection;
private const LOCALES = ['en', 'ru'];
Tabs::make('Translations')
->tabs([
Tab::make('English')->schema([
TextInput::make('title_en')->DescriptionField('description')
->previewUrl(url('/vehicles'))
->withoutImage();
use Filament\Forms\Components\RichEditor;
use Filament\Forms\Components\TextInput;
use Martin6363\FilamentSmartSeo\Forms\Components\SeoSection;
TextInput::make('title')->OgPreview();
use Filament\Pages\Page;
use Filament\Schemas\Schema;
use Martin6363\FilamentSmartSeo\Concerns\InteractsWithSeoSettings;
use Martin6363\FilamentSmartSeo\Forms\Components\SeoSection;
class SiteSettings extends Page
{
use InteractsWithSeoSettings;
public ?array $data = [];
public function mount(): void
{
$this->form->fill($this->getSeoSettingsFormData());
}
public function form(Schema $schema): Schema
{
return $schema
->statePath('data')
->components([
SeoSection::make()
->settingsKey('site.seo')
->translatable()
->sourceTitleField('site_name')
->sourceDescriptionField('site_tagline'),
]);
}
public function save(): void
{
$this->saveSeoSettingsFromFormData($this->form->getState());
}
}