fix getRelativeUrl()

This commit is contained in:
Alex Grintsvayg 2016-11-03 14:24:15 -04:00
parent a285030619
commit 191213a820
4 changed files with 7 additions and 7 deletions

View file

@ -110,7 +110,7 @@ class Post
public function getRelativeUrl()
{
return $this->postType . '/' . $this->slug;
return '/' . $this->postType . '/' . $this->slug;
}
public function getSlug()

View file

@ -2,7 +2,7 @@
<h3>Latest News</h3>
<ul class="no-style">
<?php foreach($posts as $post): ?>
<li><a href="<?php echo '/'.$post->getRelativeUrl() ?>"><?php echo $post->getTitle() ?></a></li>
<li><a href="<?php echo $post->getRelativeUrl() ?>"><?php echo $post->getTitle() ?></a></li>
<?php endforeach ?>
</ul>
</div>

View file

@ -2,10 +2,10 @@
<div class="prev span6">
<?php if ($prevPost = $post->getPrevPost()): ?>
<div class="prev-next-label">
<a href="/<?php echo $prevPost->getRelativeUrl() ?>" class="link-primary"> {{news.prev}}</a>
<a href="<?php echo $prevPost->getRelativeUrl() ?>" class="link-primary"> {{news.prev}}</a>
</div>
<div class="meta">
<a class="prev-next-title" href="/<?php echo $prevPost->getRelativeUrl() ?>">
<a class="prev-next-title" href="<?php echo $prevPost->getRelativeUrl() ?>">
<?php echo htmlentities($prevPost->getTitle()) ?>
</a>
</div>
@ -14,10 +14,10 @@
<div class="next span6">
<?php if ($nextPost = $post->getNextPost()): ?>
<div class="prev-next-label">
<a href="/<?php echo $nextPost->getRelativeUrl() ?>" class="link-primary">{{news.next}} </a>
<a href="<?php echo $nextPost->getRelativeUrl() ?>" class="link-primary">{{news.next}} </a>
</div>
<div class="meta">
<a class="prev-next-title" href="/<?php echo $nextPost->getRelativeUrl() ?>">
<a class="prev-next-title" href="<?php echo $nextPost->getRelativeUrl() ?>">
<?php echo htmlentities($nextPost->getTitle()) ?>
</a>
</div>

View file

@ -1,4 +1,4 @@
<?php $url = urlencode(Request::getHostAndProto() . '/' . $post->getRelativeUrl()) ?>
<?php $url = urlencode(Request::getHostAndProto() . $post->getRelativeUrl()) ?>
<?php $title = urlencode($post->getTitle()) ?>
<div class="social-share-buttons">
<a href="https://www.facebook.com/sharer/sharer.php?u=<?php echo $url ?>&t=<?php echo $title ?>" title="Share on Facebook" target="_blank">