From c7ac9a4d338d5bedd9b138a89468e569287491dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20=C5=A0tancl?= Date: Mon, 24 May 2021 19:15:16 +0200 Subject: [PATCH 1/3] more examples --- README.md | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 6dd6da8..8af4f80 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. @@ -208,6 +208,23 @@ 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. From 00197938d0558f1d2a27941acace46d4126fac51 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20=C5=A0tancl?= Date: Mon, 24 May 2021 19:16:02 +0200 Subject: [PATCH 2/3] move sections --- README.md | 80 +++++++++++++++++++++++++++---------------------------- 1 file changed, 40 insertions(+), 40 deletions(-) diff --git a/README.md b/README.md index 8af4f80..46eb8a3 100644 --- a/README.md +++ b/README.md @@ -166,46 +166,6 @@ 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 @@ -258,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: From d6fb3d367c0053c62ed69fde78bfac45dde53e5f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20=C5=A0tancl?= Date: Mon, 24 May 2021 19:16:27 +0200 Subject: [PATCH 3/3] syntax --- README.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 46eb8a3..0c7f0c0 100644 --- a/README.md +++ b/README.md @@ -239,17 +239,17 @@ For example: Once your view is created, register the extension: ```php -seo()->extension('facebook', view: 'my-component') +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 ...']) +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: