Skip to content

Commit

Permalink
Fix JsonLd default url (#261)
Browse files Browse the repository at this point in the history
* Fix JsonLd default url

The docs state that when providing `null` as the default JsonLd URL `URL::current()` is used. But actually `URL::full()` was used.
  • Loading branch information
marcreichel authored Feb 6, 2022
1 parent 2190dc4 commit bd2b4da
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
8 changes: 7 additions & 1 deletion src/SEOTools/JsonLd.php
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,13 @@ public function convertToArray(): array
}

if ($this->url !== false) {
$generated['url'] = $this->url ?? app('url')->full();
if ($this->url === null || $this->url === 'full') {
$generated['url'] = app('url')->full();
} elseif ($this->url === 'current') {
$generated['url'] = app('url')->current();
} else {
$generated['url'] = $this->url;
}
}

if (!empty($this->images)) {
Expand Down
2 changes: 1 addition & 1 deletion src/resources/config/seotools.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
'defaults' => [
'title' => 'Over 9000 Thousand!', // set false to total remove
'description' => 'For those who helped create the Genki Dama', // set false to total remove
'url' => false, // Set null for using Url::current(), set false to total remove
'url' => false, // Set to null or 'full' to use Url::full(), set to 'current' to use Url::current(), set false to total remove
'type' => 'WebPage',
'images' => [],
],
Expand Down

0 comments on commit bd2b4da

Please sign in to comment.