Skip to content

Commit

Permalink
Merge pull request #4 from quintype/social-description
Browse files Browse the repository at this point in the history
Adds social description.
  • Loading branch information
anagh-p authored Nov 8, 2017
2 parents e71d531 + de76f4b commit 898ea42
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/Quintype/Seo/Story.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'])) {
Expand All @@ -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(),
];

Expand All @@ -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(),
Expand Down

0 comments on commit 898ea42

Please sign in to comment.