diff --git a/README.md b/README.md index 6dd6da8..0c7f0c0 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# laravel-seo +# Laravel SEO This is a simple and extensible package for improving SEO via meta tags, such as OpenGraph tags. @@ -166,48 +166,25 @@ The `flipp()` method also returns a signed URL to the image, which lets you use @seo('title') ``` -## Customization - -This package is completely flexible, and can be customized either by having its views modified (to change the existing templates), or by you developing an extension (to add more templates). - -### Views - -You can publish the Blade views by running `php artisan vendor:publish --tag=seo-views`. - -### Extensions - -To use a custom extension, create a Blade *component* with the desired meta tags. The component should read data using `{{ seo()->get('foo') }}` or `@seo('foo')`. - -For example: - -```php - -``` - -Once your view is created, register the extension: - -```php -seo()->extension('facebook', view: 'my-component') -// The extension will use -``` - -To set data for an extension (in our case `facebook`), simply prefix calls with the extension name in camelCase, or use the `->set()` method: - -```php -seo()->facebookFoo('bar') -seo()->facebookTitle('About us') -seo()->set('facebook.description', 'We are a web development agency that ...') -seo(['facebook.description' => 'We are a web development agency that ...']) -``` - -To disable an extension, set the second argument in the `extension()` call to false: - -```php -seo()->extension('facebook', false); -``` - ## Examples +### Service Provider + +This example sets the default state in a service provider's `boot()` method: + +```php +seo() + ->site('ArchTech — Meticulously architected web applications') + ->title( + default: 'ArchTech — Meticulously architected web applications', + modify: fn (string $title) => $title . ' | ArchTech' + ) + ->description(default: 'We are a development agency ...') + ->image(default: fn () => asset('header.png')) + ->flipp('blog', 'o1vhcg5npgfu') + ->twitterSite('archtechx'); +``` + ### Controller This example configures SEO metadata from a controller. @@ -241,6 +218,46 @@ This example uses a Blade view that sets global SEO config using the values that

``` +## Customization + +This package is completely flexible, and can be customized either by having its views modified (to change the existing templates), or by you developing an extension (to add more templates). + +### Views + +You can publish the Blade views by running `php artisan vendor:publish --tag=seo-views`. + +### Extensions + +To use a custom extension, create a Blade *component* with the desired meta tags. The component should read data using `{{ seo()->get('foo') }}` or `@seo('foo')`. + +For example: + +```php + +``` + +Once your view is created, register the extension: + +```php +seo()->extension('facebook', view: 'my-component'); +// The extension will use +``` + +To set data for an extension (in our case `facebook`), simply prefix calls with the extension name in camelCase, or use the `->set()` method: + +```php +seo()->facebookFoo('bar'); +seo()->facebookTitle('About us'); +seo()->set('facebook.description', 'We are a web development agency that ...'); +seo(['facebook.description' => 'We are a web development agency that ...']); +``` + +To disable an extension, set the second argument in the `extension()` call to false: + +```php +seo()->extension('facebook', false); +``` + ## Development Run all checks locally: