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:
parent
fdd7064a00
commit
5732fc8a57
5 changed files with 7 additions and 7 deletions
|
|
@ -52,7 +52,7 @@ title(string $title)
|
||||||
description(string $description)
|
description(string $description)
|
||||||
image(string $url)
|
image(string $url)
|
||||||
|
|
||||||
twitterUser(string $username)
|
twitterSite(string $username)
|
||||||
twitterTitle(string $title)
|
twitterTitle(string $title)
|
||||||
twitterDescription(string $description)
|
twitterDescription(string $description)
|
||||||
twitterImage(string $url)
|
twitterImage(string $url)
|
||||||
|
|
@ -219,7 +219,7 @@ public function show(Post $post)
|
||||||
->title($post->title)
|
->title($post->title)
|
||||||
->description(Str::limit($post->content, 50))
|
->description(Str::limit($post->content, 50))
|
||||||
->flipp('blog', ['title' => $page->title, 'content' => $page->excerpt]);
|
->flipp('blog', ['title' => $page->title, 'content' => $page->excerpt]);
|
||||||
|
|
||||||
return view('blog.show', compact($post));
|
return view('blog.show', compact($post));
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
<meta name="twitter:card" content="summary_large_image">
|
<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.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.description')) <meta name="twitter:description" content="@seo('twitter.description')"> @endif
|
||||||
@if(seo('twitter.image')) <meta name="twitter:image" content="@seo('twitter.image')" /> @endif
|
@if(seo('twitter.image')) <meta name="twitter:image" content="@seo('twitter.image')" /> @endif
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@ use Illuminate\Support\Str;
|
||||||
* @method $this site(string $site) Set the site name.
|
* @method $this site(string $site) Set the site name.
|
||||||
* @method $this image(string $url) Set the cover image.
|
* @method $this image(string $url) Set the cover image.
|
||||||
* @method $this twitter(enabled $bool = true) Enable the Twitter extension.
|
* @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 twitterTitle(string $title) Set the Twitter title.
|
||||||
* @method $this twitterDescription(string $description) Set the Twitter description.
|
* @method $this twitterDescription(string $description) Set the Twitter description.
|
||||||
* @method $this twitterImage(string $url) Set the Twitter cover image.
|
* @method $this twitterImage(string $url) Set the Twitter cover image.
|
||||||
|
|
@ -48,7 +48,7 @@ class SEOManager
|
||||||
/** Get a list of used keys. */
|
/** Get a list of used keys. */
|
||||||
protected function getKeys(): array
|
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->defaults))
|
||||||
->merge(array_keys($this->values))
|
->merge(array_keys($this->values))
|
||||||
->unique()
|
->unique()
|
||||||
|
|
|
||||||
|
|
@ -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 () {
|
test('when an extension is enabled, all of its keys are included in the resolved values', function () {
|
||||||
expect(seo()->twitter()->all())
|
expect(seo()->twitter()->all())
|
||||||
->not()->toBeEmpty()
|
->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 () {
|
test('extension keys can be set by prefixing the call with the extension name and using camelcase', function () {
|
||||||
|
|
|
||||||
|
|
@ -73,7 +73,7 @@ test('thunks can be used as values', function () {
|
||||||
expect(seo('title'))->toBe('bar');
|
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');
|
seo()->title(default: fn () => 'bar');
|
||||||
|
|
||||||
expect(seo('title'))->toBe('bar');
|
expect(seo('title'))->toBe('bar');
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue