diff --git a/src/Contracts/SeoHelper.php b/src/Contracts/SeoHelper.php
index cefc3a7..bbbfa42 100644
--- a/src/Contracts/SeoHelper.php
+++ b/src/Contracts/SeoHelper.php
@@ -8,9 +8,9 @@
*/
interface SeoHelper extends Renderable
{
- /* ------------------------------------------------------------------------------------------------
+ /* -----------------------------------------------------------------
| Getters & Setters
- | ------------------------------------------------------------------------------------------------
+ | -----------------------------------------------------------------
*/
/**
* Get SeoMeta instance.
@@ -79,6 +79,16 @@ public function setSeoTwitter(SeoTwitter $seoTwitter);
* @return self
*/
public function setTitle($title, $siteName = null, $separator = null);
+
+ /**
+ * Set the site name.
+ *
+ * @param string $siteName
+ *
+ * @return self
+ */
+ public function setSiteName($siteName);
+
/**
* Set description.
*
@@ -98,17 +108,17 @@ public function setDescription($description);
public function setKeywords($keywords);
/**
- * Set the site name.
+ * Set Image.
*
- * @param string $siteName
+ * @param string $imageUrl
*
- * @return self
+ * @return \Arcanedev\SeoHelper\SeoHelper
*/
- public function setSiteName($siteName);
+ public function setImage($imageUrl);
- /* ------------------------------------------------------------------------------------------------
- | Main Functions
- | ------------------------------------------------------------------------------------------------
+ /* -----------------------------------------------------------------
+ | Main Methods
+ | -----------------------------------------------------------------
*/
/**
* Render all seo tags with HtmlString object.
diff --git a/src/SeoHelper.php b/src/SeoHelper.php
index cf7c3b3..afd3314 100644
--- a/src/SeoHelper.php
+++ b/src/SeoHelper.php
@@ -13,9 +13,9 @@
*/
class SeoHelper implements SeoHelperContract
{
- /* ------------------------------------------------------------------------------------------------
+ /* -----------------------------------------------------------------
| Properties
- | ------------------------------------------------------------------------------------------------
+ | -----------------------------------------------------------------
*/
/**
* The SeoMeta instance.
@@ -38,9 +38,9 @@ class SeoHelper implements SeoHelperContract
*/
private $seoTwitter;
- /* ------------------------------------------------------------------------------------------------
+ /* -----------------------------------------------------------------
| Constructor
- | ------------------------------------------------------------------------------------------------
+ | -----------------------------------------------------------------
*/
/**
* Make SeoHelper instance.
@@ -59,9 +59,9 @@ public function __construct(
$this->setSeoTwitter($seoTwitter);
}
- /* ------------------------------------------------------------------------------------------------
+ /* -----------------------------------------------------------------
| Getters & Setters
- | ------------------------------------------------------------------------------------------------
+ | -----------------------------------------------------------------
*/
/**
* Get SeoMeta instance.
@@ -210,9 +210,24 @@ public function setKeywords($keywords)
return $this;
}
- /* ------------------------------------------------------------------------------------------------
- | Main Functions
- | ------------------------------------------------------------------------------------------------
+ /**
+ * Set Image.
+ *
+ * @param string $imageUrl
+ *
+ * @return \Arcanedev\SeoHelper\SeoHelper
+ */
+ public function setImage($imageUrl)
+ {
+ $this->openGraph()->setImage($imageUrl);
+ $this->twitter()->addImage($imageUrl);
+
+ return $this;
+ }
+
+ /* -----------------------------------------------------------------
+ | Main Methods
+ | -----------------------------------------------------------------
*/
/**
* Render all seo tags.
diff --git a/tests/SeoHelperTest.php b/tests/SeoHelperTest.php
index 9e5d3cf..61a4900 100644
--- a/tests/SeoHelperTest.php
+++ b/tests/SeoHelperTest.php
@@ -182,6 +182,23 @@ public function it_can_set_and_render_keywords()
$this->assertContains($expected, (string) $this->seoHelper);
}
+ /** @test */
+ public function it_can_set_and_render_image()
+ {
+ $this->seoHelper->setImage($imageUrl = 'http://localhost/assets/img/logo.png');
+
+ $expectations = [
+ '',
+ ''
+ ];
+
+ $rendered = $this->seoHelper->render();
+
+ foreach ($expectations as $expected) {
+ $this->assertContains($expected, $rendered);
+ }
+ }
+
/** @test */
public function it_can_render_all()
{