Skip to content

Commit 29dc474

Browse files
committed
better image config
1 parent d4255ea commit 29dc474

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ composer require elegantly/laravel-seo
2828
You can publish the config file with:
2929

3030
```bash
31-
php artisan vendor:publish --tag="laravel-seo-config"
31+
php artisan vendor:publish --tag="seo-config"
3232
```
3333

3434
This is the content of the published config file:

src/SeoData.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,9 @@ public function __construct(
3131
public ?array $schemas = null,
3232
public ?SeoTags $customTags = null,
3333
) {
34-
$this->title = $title ?? config('seo.title') ?? '';
34+
$this->title = $title ?? __(config('seo.title')) ?? '';
3535
$this->canonical = $canonical ?? URL::current();
36-
$this->description = $description ?? config('seo.description');
36+
$this->description = $description ?? __(config('seo.description'));
3737
$this->robots = $robots ?? config('seo.robots');
3838
$this->sitemap = $sitemap ?? config('seo.sitemap');
3939
$this->image = $image ?? $this->getImageFromConfig();
@@ -43,7 +43,9 @@ public function __construct(
4343
public function getImageFromConfig(): ?Image
4444
{
4545
if ($image = config('seo.image')) {
46-
return new Image($image);
46+
return new Image(
47+
url: filter_var($image, FILTER_VALIDATE_URL) ? $image : asset($image)
48+
);
4749
}
4850

4951
return null;

0 commit comments

Comments
 (0)