Skip to content
This repository was archived by the owner on Oct 20, 2025. It is now read-only.

Commit dc74a78

Browse files
committed
Update BladeDirectives.php
1 parent e44cdb1 commit dc74a78

File tree

1 file changed

+21
-11
lines changed

1 file changed

+21
-11
lines changed

src/Http/BladeDirectives.php

Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -98,17 +98,27 @@ public static function parseTableCellDirectiveExpression(string $expression): ar
9898
*/
9999
public function registerSEODirectives()
100100
{
101-
Blade::directive(config('splade.blade.seo_title_directive'), function ($expression) {
102-
return "<?php \ProtoneMedia\Splade\Facades\SEO::title($expression); ?>";
103-
});
104-
105-
Blade::directive(config('splade.blade.seo_description_directive'), function ($expression) {
106-
return "<?php \ProtoneMedia\Splade\Facades\SEO::description($expression); ?>";
107-
});
108-
109-
Blade::directive(config('splade.blade.seo_keywords_directive'), function ($expression) {
110-
return "<?php \ProtoneMedia\Splade\Facades\SEO::keywords($expression); ?>";
111-
});
101+
$title = config('splade.blade.seo_title_directive', 'seoTitle');
102+
$description = config('splade.blade.seo_description_directive', 'seoDescription');
103+
$keywords = config('splade.blade.seo_keywords_directive', 'seoKeywords');
104+
105+
if ($title !== false) {
106+
Blade::directive($title, function ($expression) {
107+
return "<?php \ProtoneMedia\Splade\Facades\SEO::title($expression); ?>";
108+
});
109+
}
110+
111+
if ($description !== false) {
112+
Blade::directive($description, function ($expression) {
113+
return "<?php \ProtoneMedia\Splade\Facades\SEO::description($expression); ?>";
114+
});
115+
}
116+
117+
if ($keywords !== false) {
118+
Blade::directive($keywords, function ($expression) {
119+
return "<?php \ProtoneMedia\Splade\Facades\SEO::keywords($expression); ?>";
120+
});
121+
}
112122
}
113123

114124
/**

0 commit comments

Comments
 (0)