1. Go to this page and download the library: Download asignua/filament-seo-files 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/ */
asignua / filament-seo-files example snippets
use Asignua\FilamentSeoFiles\SeoFilesPlugin;
$panel->plugin(SeoFilesPlugin::make()
->authorize(fn (): bool => auth()->user()?->isAdmin()));
use Asignua\FilamentSeoFiles\Contracts\LlmsFullSource;
use Asignua\FilamentSeoFiles\Contracts\LlmsIndexSource;
use Asignua\FilamentSeoFiles\Contracts\SitemapSource;
use Asignua\FilamentSeoFiles\Data\LlmsDocument;
use Asignua\FilamentSeoFiles\Data\LlmsLink;
use Asignua\FilamentSeoFiles\Data\LlmsSection;
use Asignua\FilamentSeoFiles\Data\SitemapEntry;
class CatalogSource implements LlmsFullSource, LlmsIndexSource, SitemapSource
{
public function sitemapEntries(): iterable
{
foreach (Product::query()->lazyById() as $product) {
yield new SitemapEntry(
url: "https://shop.test/p/{$product->slug}", // the default language
alternates: ['en' => "https://shop.test/p/{$product->slug}",
'uk' => "https://shop.test/uk/p/{$product->slug}"],
lastModified: $product->updated_at, // optional
);
}
}
public function llmsSections(string $locale): iterable
{
yield new LlmsSection('Catalogue', [
new LlmsLink('All products', 'https://shop.test/p', 'The full catalogue'),
]);
}
public function llmsDocuments(string $locale): iterable
{
yield new LlmsDocument('Delivery', 'https://shop.test/delivery', "# Delivery\n\nWe ship worldwide.");
}
}
use Asignua\FilamentSeoFiles\Actions\EditLlmsAction;
use Asignua\FilamentSeoFiles\Actions\EditRobotsAction;
use Asignua\FilamentSeoFiles\Actions\GenerateLlmsAction;
use Asignua\FilamentSeoFiles\Actions\GenerateSitemapAction;
public function generateSitemapAction(): Action { return GenerateSitemapAction::make(); }
public function editRobotsAction(): Action { return EditRobotsAction::make(); }
public function generateLlmsAction(): Action { return GenerateLlmsAction::make(); }
public function editLlmsAction(): Action { return EditLlmsAction::make(); }