1
0
Fork 0
mirror of https://github.com/archtechx/laravel-seo.git synced 2025-12-12 09:54:03 +00:00

Add examples

This commit is contained in:
Samuel Štancl 2021-05-24 11:44:13 +02:00 committed by GitHub
parent 3b203d70ff
commit e2309562a6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -206,6 +206,39 @@ To disable an extension, set the second argument in the `extension()` call to fa
seo()->extension('facebook', false); 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')
<h1>{{ $page->title }}</h1>
<p>{{ $page->excerpt }}</p>
<p class="prose">
{{ $page->body }}
</p>
```
## Development ## Development
Run all checks locally: Run all checks locally: