diff --git a/src/Quintype/Seo/Story.php b/src/Quintype/Seo/Story.php index f7e0981..e28050f 100644 --- a/src/Quintype/Seo/Story.php +++ b/src/Quintype/Seo/Story.php @@ -53,6 +53,16 @@ protected function getDescription() } } + protected function getSocialDescription() { + if(isset($this->story['summary'])) { + return $this->story['summary']; + } elseif (isset($this->story['seo']['meta-description'])&&($this->story['seo']['meta-description']!="")) { + return $this->story['seo']['meta-description']; + } else { + return ''; + } + } + protected function getSectionName() { if (isset($this->story['sections'][0]['name'])) { @@ -78,7 +88,7 @@ private function getOgAttributes() 'type' => 'article', 'url' => $this->getCanonicalUrl(), 'site-name' => trim($this->config['title']), - 'description' => trim($this->getDescription()), + 'description' => trim($this->getSocialDescription()), 'image' => $this->getHeroImageUrl(), ]; @@ -100,7 +110,7 @@ private function getTwitterAttributes() { $attributes = [ 'title' => trim($this->getTitle()), - 'description' => trim($this->getDescription()), + 'description' => trim($this->getSocialDescription()), 'card' => 'summary_large_image', 'site' => $this->getTwitterSite(), 'creator' => $this->getTwitterCreator(),