mirror of
https://github.com/archtechx/laravel-seo.git
synced 2025-12-12 01:44:03 +00:00
Add examples
This commit is contained in:
parent
3b203d70ff
commit
e2309562a6
1 changed files with 33 additions and 0 deletions
33
README.md
33
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')
|
||||
|
||||
<h1>{{ $page->title }}</h1>
|
||||
<p>{{ $page->excerpt }}</p>
|
||||
|
||||
<p class="prose">
|
||||
{{ $page->body }}
|
||||
</p>
|
||||
```
|
||||
|
||||
## Development
|
||||
|
||||
Run all checks locally:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue