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

Add support 'keywords' meta tag

This commit is contained in:
Ngo Quoc Dat 2023-04-21 23:10:12 +07:00
parent 3a17c8ee11
commit 100660e210
6 changed files with 11 additions and 6 deletions

View file

@ -20,7 +20,7 @@ class GenerateFaviconsCommand extends Command
if (! is_string($path)) { if (! is_string($path)) {
$this->error('The `from` argument must be a string.'); $this->error('The `from` argument must be a string.');
return Command::FAILURE; return self::FAILURE;
} }
$this->info('Generating favicons...'); $this->info('Generating favicons...');
@ -28,13 +28,13 @@ class GenerateFaviconsCommand extends Command
if (! class_exists(ImageManager::class)) { if (! class_exists(ImageManager::class)) {
$this->error('Intervention not available, please run `composer require intervention/image`'); $this->error('Intervention not available, please run `composer require intervention/image`');
return Command::FAILURE; return self::FAILURE;
} }
if (! file_exists($path)) { if (! file_exists($path)) {
$this->error("Given icon path `{$path}` does not exist."); $this->error("Given icon path `{$path}` does not exist.");
return Command::FAILURE; return self::FAILURE;
} }
// GD driver doesn't support .ico, that's why we use ImageMagick. // GD driver doesn't support .ico, that's why we use ImageMagick.
@ -56,6 +56,6 @@ class GenerateFaviconsCommand extends Command
$this->info('All favicons have been generated!'); $this->info('All favicons have been generated!');
return Command::SUCCESS; return self::SUCCESS;
} }
} }

View file

@ -11,12 +11,13 @@ use Illuminate\Support\Str;
/** /**
* @method $this title(string $title = null, ...$args) Set the title. * @method $this title(string $title = null, ...$args) Set the title.
* @method $this description(string $description = null, ...$args) Set the description. * @method $this description(string $description = null, ...$args) Set the description.
* @method $this keywords(string $keywords = null, ...$args) Set the keywords.
* @method $this url(string $url = null, ...$args) Set the canonical URL. * @method $this url(string $url = null, ...$args) Set the canonical URL.
* @method $this site(string $site = null, ...$args) Set the site name. * @method $this site(string $site = null, ...$args) Set the site name.
* @method $this image(string $url = null, ...$args) Set the cover image. * @method $this image(string $url = null, ...$args) Set the cover image.
* @method $this type(string $type = null, ...$args) Set the page type. * @method $this type(string $type = null, ...$args) Set the page type.
* @method $this locale(string $locale = null, ...$args) Set the page locale. * @method $this locale(string $locale = null, ...$args) Set the page locale.
* @method $this twitter(enabled $bool = true, ...$args) Enable the Twitter extension. * @method $this twitter(bool $enabled = true, ...$args) Enable the Twitter extension.
* @method $this twitterCreator(string $username = null, ...$args) Set the Twitter author. * @method $this twitterCreator(string $username = null, ...$args) Set the Twitter author.
* @method $this twitterSite(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 twitterTitle(string $title = null, ...$args) Set the Twitter title.

View file

@ -17,7 +17,7 @@ class SEOServiceProvider extends ServiceProvider
public function boot(): void public function boot(): void
{ {
$this->loadViewsFrom(__DIR__ . '/../assets/views', 'seo'); $this->loadViewsFrom(__DIR__ . '/../views', 'seo');
if ($this->app->runningInConsole()) { if ($this->app->runningInConsole()) {
$this->commands([ $this->commands([

View file

@ -12,6 +12,10 @@
<meta name="description" content="@seo('description')" /> <meta name="description" content="@seo('description')" />
@endif @endif
@if(seo('keywords'))
<meta name="keywords" content="@seo('keywords')">
@endif
@if(seo('type')) @if(seo('type'))
<meta property="og:type" content="@seo('type')" /> <meta property="og:type" content="@seo('type')" />
@else @else