Skip to content

Commit

Permalink
Merge pull request #5 from quintype/og-description
Browse files Browse the repository at this point in the history
Added OG description fallback
  • Loading branch information
ajaymenon0 authored Nov 10, 2017
2 parents 714833f + c9e3034 commit 92b6ada
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion src/Quintype/Seo/Section.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,14 @@ function prepareTags() {
]
];
} else {
return ['title' => trim($this->getPageTitle())];
return [
'title' => trim($this->getPageTitle()),
'description' => trim($this->getDescription()),
'og' => [
'title' => trim($this->getPageTitle()),
'description' => trim($this->getDescription())
]
];
}
}

Expand All @@ -41,4 +48,16 @@ protected function getPageTitle(){
return $this->sectionName . $this->titleTextToAppend;
}
}

protected function getDescription() {
if(isset($this->seoMetadata['description'])){
if($this->seoMetadata['description']==''){
return $this->sectionName . $this->titleTextToAppend;
}else{
return $this->seoMetadata['description'];
}
} else {
return $this->sectionName . $this->titleTextToAppend;
}
}
}

0 comments on commit 92b6ada

Please sign in to comment.