Skip to content

Commit

Permalink
feat: add ogImage shortcut
Browse files Browse the repository at this point in the history
  • Loading branch information
BernhardBaumrock committed Dec 26, 2023
1 parent 80099f5 commit 2131298
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions Seo.php
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,22 @@ public function markup($tag, $value = null): self
return $this->setMarkup($tag, $value);
}

/**
* Set og:image tag
*
* Usage:
* $seo->ogImage(function($page) {
* if($page instanceof Foo) {
* if($img = $page->image()) return $img;
* }
* });
*/
public function ogImage(callable $callback): self
{
$this->setValue("og:image", $callback);
return $this;
}

public function render(): string
{
$out = '';
Expand Down

0 comments on commit 2131298

Please sign in to comment.