mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-22 14:52:41 +01:00
tweak phame blog template a bit for better Facebook integration
Summary: this makes it more sensical when you hit "share" from a bookmarklet or cut and paste a link into FB, basically by having post-specific data when sharing a post. Test Plan: looked at generated HTML on my test blog Reviewers: epriestley Reviewed By: epriestley CC: chad, aran, Korvin Differential Revision: https://secure.phabricator.com/D4266
This commit is contained in:
parent
9e28d12c57
commit
9c27c7ab60
2 changed files with 30 additions and 4 deletions
|
@ -9,6 +9,24 @@ abstract class PhameBasicBlogSkin extends PhameBlogSkin {
|
|||
|
||||
private $pager;
|
||||
private $title;
|
||||
private $description;
|
||||
private $oGType;
|
||||
|
||||
protected function setOGType($og_type) {
|
||||
$this->oGType = $og_type;
|
||||
return $this;
|
||||
}
|
||||
protected function getOGType() {
|
||||
return $this->oGType;
|
||||
}
|
||||
|
||||
protected function setDescription($description) {
|
||||
$this->description = $description;
|
||||
return $this;
|
||||
}
|
||||
protected function getDescription() {
|
||||
return $this->description;
|
||||
}
|
||||
|
||||
protected function setTitle($title) {
|
||||
$this->title = $title;
|
||||
|
@ -192,7 +210,10 @@ abstract class PhameBasicBlogSkin extends PhameBlogSkin {
|
|||
|
||||
$matches = null;
|
||||
$path = $request->getPath();
|
||||
// default to the blog-wide values
|
||||
$this->setTitle($this->getBlog()->getName());
|
||||
$this->setDescription($this->getBlog()->getDescription());
|
||||
$this->setOGType('website');
|
||||
if (preg_match('@^/post/(?P<name>.*)$@', $path, $matches)) {
|
||||
$post = id(new PhamePostQuery())
|
||||
->setViewer($user)
|
||||
|
@ -201,7 +222,10 @@ abstract class PhameBasicBlogSkin extends PhameBlogSkin {
|
|||
->executeOne();
|
||||
|
||||
if ($post) {
|
||||
$description = $post->getMarkupText(PhamePost::MARKUP_FIELD_SUMMARY);
|
||||
$this->setTitle($post->getTitle());
|
||||
$this->setDescription($description);
|
||||
$this->setOGType('article');
|
||||
$view = head($this->buildPostViews(array($post)));
|
||||
return $this->renderPostDetail($view);
|
||||
}
|
||||
|
|
|
@ -80,10 +80,12 @@ final class PhameBasicTemplateBlogSkin extends PhameBasicBlogSkin {
|
|||
|
||||
private function getDefaultScope() {
|
||||
return array(
|
||||
'skin' => $this,
|
||||
'blog' => $this->getBlog(),
|
||||
'uri' => $this->getURI(''),
|
||||
'title' => $this->getTitle(),
|
||||
'skin' => $this,
|
||||
'blog' => $this->getBlog(),
|
||||
'uri' => $this->getURI(''),
|
||||
'title' => $this->getTitle(),
|
||||
'description' => $this->getDescription(),
|
||||
'og_type' => $this->getOGType(),
|
||||
);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue