Skip to content

Commit 9ce6843

Browse files
authored
Add twitter:creator meta tag (#21)
1 parent 754b393 commit 9ce6843

File tree

4 files changed

+5
-2
lines changed

4 files changed

+5
-2
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ title(string $title)
5353
description(string $description)
5454
image(string $url)
5555

56+
twitterCreator(string $username)
5657
twitterSite(string $username)
5758
twitterTitle(string $title)
5859
twitterDescription(string $description)

assets/views/components/extensions/twitter.blade.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<meta name="twitter:card" content="summary_large_image">
2+
@if(seo('twitter.creator')) <meta name="twitter:creator" content="@seo('twitter.creator')"> @endif
23
@if(seo('twitter.site')) <meta name="twitter:site" content="@seo('twitter.site')"> @endif
34
@if(seo('twitter.title')) <meta name="twitter:title" content="@seo('twitter.title')"> @endif
45
@if(seo('twitter.description')) <meta name="twitter:description" content="@seo('twitter.description')"> @endif

src/SEOManager.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
* @method $this image(string $url = null, ...$args) Set the cover image.
1616
* @method $this type(string $type = null, ...$args) Set the page type.
1717
* @method $this twitter(enabled $bool = true, ...$args) Enable the Twitter extension.
18+
* @method $this twitterCreator(string $username = null, ...$args) Set the Twitter author.
1819
* @method $this twitterSite(string $username = null, ...$args) Set the Twitter author.
1920
* @method $this twitterTitle(string $title = null, ...$args) Set the Twitter title.
2021
* @method $this twitterDescription(string $description = null, ...$args) Set the Twitter description.
@@ -55,7 +56,7 @@ protected function getKeys(): array
5556
{
5657
return collect([
5758
'site', 'title', 'image', 'description', 'url', 'type',
58-
'twitter.site', 'twitter.title', 'twitter.image', 'twitter.description',
59+
'twitter.creator', 'twitter.site', 'twitter.title', 'twitter.image', 'twitter.description',
5960
])
6061
->merge(array_keys($this->defaults))
6162
->merge(array_keys($this->values))

tests/Pest/ExtensionTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
test('when an extension is enabled, all of its keys are included in the resolved values', function () {
2626
expect(seo()->twitter()->all())
2727
->not()->toBeEmpty()
28-
->toHaveKeys(['twitter.title', 'twitter.description', 'twitter.site', 'twitter.image']);
28+
->toHaveKeys(['twitter.title', 'twitter.description', 'twitter.creator', 'twitter.site', 'twitter.image']);
2929
});
3030

3131
test('extension keys can be set by prefixing the call with the extension name and using camelcase', function () {

0 commit comments

Comments
 (0)