diff --git a/README.md b/README.md index cc600fd..2eff117 100644 --- a/README.md +++ b/README.md @@ -53,6 +53,7 @@ title(string $title) description(string $description) image(string $url) +twitterCreator(string $username) twitterSite(string $username) twitterTitle(string $title) twitterDescription(string $description) diff --git a/assets/views/components/extensions/twitter.blade.php b/assets/views/components/extensions/twitter.blade.php index 5ae57de..1728818 100644 --- a/assets/views/components/extensions/twitter.blade.php +++ b/assets/views/components/extensions/twitter.blade.php @@ -1,4 +1,5 @@ +@if(seo('twitter.creator')) @endif @if(seo('twitter.site')) @endif @if(seo('twitter.title')) @endif @if(seo('twitter.description')) @endif diff --git a/src/SEOManager.php b/src/SEOManager.php index 68d6d68..9c8da38 100644 --- a/src/SEOManager.php +++ b/src/SEOManager.php @@ -15,6 +15,7 @@ * @method $this image(string $url = null, ...$args) Set the cover image. * @method $this type(string $type = null, ...$args) Set the page type. * @method $this twitter(enabled $bool = true, ...$args) Enable the Twitter extension. + * @method $this twitterCreator(string $username = null, ...$args) Set the Twitter author. * @method $this twitterSite(string $username = null, ...$args) Set the Twitter author. * @method $this twitterTitle(string $title = null, ...$args) Set the Twitter title. * @method $this twitterDescription(string $description = null, ...$args) Set the Twitter description. @@ -55,7 +56,7 @@ protected function getKeys(): array { return collect([ 'site', 'title', 'image', 'description', 'url', 'type', - 'twitter.site', 'twitter.title', 'twitter.image', 'twitter.description', + 'twitter.creator', 'twitter.site', 'twitter.title', 'twitter.image', 'twitter.description', ]) ->merge(array_keys($this->defaults)) ->merge(array_keys($this->values)) diff --git a/tests/Pest/ExtensionTest.php b/tests/Pest/ExtensionTest.php index d4cf745..0bb0911 100644 --- a/tests/Pest/ExtensionTest.php +++ b/tests/Pest/ExtensionTest.php @@ -25,7 +25,7 @@ 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.site', 'twitter.image']); + ->toHaveKeys(['twitter.title', 'twitter.description', 'twitter.creator', 'twitter.site', 'twitter.image']); }); test('extension keys can be set by prefixing the call with the extension name and using camelcase', function () {