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

Twitter user -> Twitter site

This commit is contained in:
Samuel Štancl 2021-05-24 18:26:08 +02:00
parent fdd7064a00
commit 5732fc8a57
5 changed files with 7 additions and 7 deletions

View file

@ -52,7 +52,7 @@ title(string $title)
description(string $description)
image(string $url)
twitterUser(string $username)
twitterSite(string $username)
twitterTitle(string $title)
twitterDescription(string $description)
twitterImage(string $url)
@ -219,7 +219,7 @@ public function show(Post $post)
->title($post->title)
->description(Str::limit($post->content, 50))
->flipp('blog', ['title' => $page->title, 'content' => $page->excerpt]);
return view('blog.show', compact($post));
}
```

View file

@ -1,5 +1,5 @@
<meta name="twitter:card" content="summary_large_image">
@if(seo('twitter.user')) <meta name="twitter:site" content="@seo('twitter.user')"> @endif
@if(seo('twitter.site')) <meta name="twitter:site" content="@seo('twitter.site')"> @endif
@if(seo('twitter.title')) <meta name="twitter:title" content="@seo('twitter.title')"> @endif
@if(seo('twitter.description')) <meta name="twitter:description" content="@seo('twitter.description')"> @endif
@if(seo('twitter.image')) <meta name="twitter:image" content="@seo('twitter.image')" /> @endif

View file

@ -13,7 +13,7 @@ use Illuminate\Support\Str;
* @method $this site(string $site) Set the site name.
* @method $this image(string $url) Set the cover image.
* @method $this twitter(enabled $bool = true) Enable the Twitter extension.
* @method $this twitterUser(string $username) Set the Twitter author.
* @method $this twitterSite(string $username) Set the Twitter author.
* @method $this twitterTitle(string $title) Set the Twitter title.
* @method $this twitterDescription(string $description) Set the Twitter description.
* @method $this twitterImage(string $url) Set the Twitter cover image.
@ -48,7 +48,7 @@ class SEOManager
/** Get a list of used keys. */
protected function getKeys(): array
{
return collect(['site', 'title', 'image', 'description', 'twitter.user', 'twitter.title', 'twitter.image', 'twitter.description'])
return collect(['site', 'title', 'image', 'description', 'twitter.site', 'twitter.title', 'twitter.image', 'twitter.description'])
->merge(array_keys($this->defaults))
->merge(array_keys($this->values))
->unique()

View file

@ -25,7 +25,7 @@ test('the twitter extension can be disabled by calling twitter with false', func
test('when an extension is enabled, all of its keys are included in the resolved values', function () {
expect(seo()->twitter()->all())
->not()->toBeEmpty()
->toHaveKeys(['twitter.title', 'twitter.description', 'twitter.user', 'twitter.image']);
->toHaveKeys(['twitter.title', 'twitter.description', 'twitter.site', 'twitter.image']);
});
test('extension keys can be set by prefixing the call with the extension name and using camelcase', function () {

View file

@ -73,7 +73,7 @@ test('thunks can be used as values', function () {
expect(seo('title'))->toBe('bar');
});
test('thunks can be used as deafults', function () {
test('thunks can be used as defaults', function () {
seo()->title(default: fn () => 'bar');
expect(seo('title'))->toBe('bar');