From e2309562a62dbcd87181acc744e7358dca647d7f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20=C5=A0tancl?= Date: Mon, 24 May 2021 11:44:13 +0200 Subject: [PATCH 1/2] Add examples --- README.md | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/README.md b/README.md index 2de0665..ffefb76 100644 --- a/README.md +++ b/README.md @@ -206,6 +206,39 @@ To disable an extension, set the second argument in the `extension()` call to fa seo()->extension('facebook', false); ``` +## Examples + +### Controller + +```php +public function show(Post $post) +{ + seo() + ->title($post->title) + ->description(Str::limit($post->content, 50)) + ->flipp('blog', ['title' => $page->title, 'content' => $page->excerpt]); + + return view('blog.show', compact($post)); +} +``` + +### View + +This example uses a Blade view that sets global SEO config using the values that are passed to the view. + +```html +@seo('title', $page->name) +@seo('description', $page->excerpt) +@seo('flipp', 'content') + +

{{ $page->title }}

+

{{ $page->excerpt }}

+ +

+ {{ $page->body }} +

+``` + ## Development Run all checks locally: From ebdc1069d981eb29c550aaf7772e85b053185d0d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20=C5=A0tancl?= Date: Mon, 24 May 2021 11:44:50 +0200 Subject: [PATCH 2/2] Update README.md --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index ffefb76..a642d54 100644 --- a/README.md +++ b/README.md @@ -210,6 +210,8 @@ seo()->extension('facebook', false); ### Controller +This example configures SEO metadata from a controller. + ```php public function show(Post $post) {