Skip to content

Commit

Permalink
Fixed ability to override Open Graph Url, if default url set to `fals…
Browse files Browse the repository at this point in the history
…e` (#193)
  • Loading branch information
Slava Razum committed Mar 11, 2020
1 parent 29a6f5b commit 445c0bf
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/SEOTools/OpenGraph.php
Original file line number Diff line number Diff line change
Expand Up @@ -279,15 +279,16 @@ protected function setupDefaults()
[];

foreach ($defaults as $key => $value) {
if ($key == 'images') {
if ($key === 'images') {
if (empty($this->images)) {
$this->images = $value;
}
} elseif ($key == 'url' && $value === null) {
$this->addProperty('url', $this->url ?: (($value === null)
? app('url')->current()
: $this->config['defaults.url'])
);
} elseif ($key === 'url' && empty($value)) {
if ($value === null) {
$this->addProperty('url', $this->url ?: app('url')->current());
} elseif ($this->url) {
$this->addProperty('url', $this->url);
}
} elseif (! empty($value) && ! array_key_exists($key, $this->properties)) {
$this->addProperty($key, $value);
}
Expand Down

0 comments on commit 445c0bf

Please sign in to comment.