1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-10 00:42:41 +01:00

one more phame tweak for better social sharing -- make sure $uri is the full uri

Summary: basically when we're on a page we have a URIPath so set that and pass it over. I wasn't super duper happy with this but it seems to be the best way to pass this data.

Test Plan: verified the og:url was correct on my dev instance of phacility blog for both the main blog and individual post view

Reviewers: epriestley

Reviewed By: epriestley

CC: chad, aran, Korvin

Differential Revision: https://secure.phabricator.com/D4269
This commit is contained in:
Bob Trahan 2012-12-21 13:46:23 -08:00
parent 2cc7f82ece
commit 2b0526e9f9
3 changed files with 14 additions and 2 deletions

View file

@ -9,7 +9,7 @@
<body>
<div class="oblivious-info">
<h1>
<a href="<?php echo _e($uri); ?>"><?php
<a href="<?php echo _e($home_uri); ?>"><?php
echo _e($blog->getName());
?></a>
</h1>

View file

@ -11,6 +11,15 @@ abstract class PhameBasicBlogSkin extends PhameBlogSkin {
private $title;
private $description;
private $oGType;
private $uriPath;
public function setURIPath($uri_path) {
$this->uriPath = $uri_path;
return $this;
}
public function getURIPath() {
return $this->uriPath;
}
protected function setOGType($og_type) {
$this->oGType = $og_type;
@ -214,6 +223,7 @@ abstract class PhameBasicBlogSkin extends PhameBlogSkin {
$this->setTitle($this->getBlog()->getName());
$this->setDescription($this->getBlog()->getDescription());
$this->setOGType('website');
$this->setURIPath('');
if (preg_match('@^/post/(?P<name>.*)$@', $path, $matches)) {
$post = id(new PhamePostQuery())
->setViewer($user)
@ -226,6 +236,7 @@ abstract class PhameBasicBlogSkin extends PhameBlogSkin {
$this->setTitle($post->getTitle());
$this->setDescription($description);
$this->setOGType('article');
$this->setURIPath('post/'.$post->getPhameTitle());
$view = head($this->buildPostViews(array($post)));
return $this->renderPostDetail($view);
}

View file

@ -82,7 +82,8 @@ final class PhameBasicTemplateBlogSkin extends PhameBasicBlogSkin {
return array(
'skin' => $this,
'blog' => $this->getBlog(),
'uri' => $this->getURI(''),
'uri' => $this->getURI($this->getURIPath()),
'home_uri' => $this->getURI(''),
'title' => $this->getTitle(),
'description' => $this->getDescription(),
'og_type' => $this->getOGType(),