Skip to content

Instantly share code, notes, and snippets.

@bastianallgeier
Forked from niklausgerber/gist:5626584
Created May 22, 2013 10:28
Show Gist options
  • Save bastianallgeier/5626638 to your computer and use it in GitHub Desktop.
Save bastianallgeier/5626638 to your computer and use it in GitHub Desktop.
<?php $article = $pages->find('blog')->children()->last() ?>
<div class="footer">
<div class="container">
<div class="grid full">
// Displays the latest blog article
<h3><?php echo html($article->title()) ?></h3>
<small><?php echo html($article->Published()) ?></small>
<p><?php echo excerpt($article->text(), 250) ?>... <a href="<?php echo html($article->url()) ?>">Continue reading</a></p>
</div>
<div class="cf"></div>
<hr />
<div id="previous" class="grid half">
// Within the blog it should display the previous blog aritcle (also if I am on a site which is not in the blog directory)
<?php if($page->hasPrev()): ?>
<p><a href="<?php echo $page->prev()->url() ?>"><?php echo $page->prev()->title() ?><br /><small><?php echo excerpt($page->prev()->text(), 50) ?>...</small></a></p>
<?php endif ?>
// Else if there is no previous one or I am actually on another page it should display the second latest blog article
</div>
// Within the blog it should display the next blog aritcle (also if I am on a site which is not in the blog directory)
<div id="next" class="grid half">
<?php if($page->hasNext()): ?>
<p><a href="<?php echo $page->next()->url() ?>"><?php echo $page->next()->title() ?><br /><small><?php echo excerpt($page->next()->text(), 50) ?>...</small></a></p>
<?php endif ?>
// Else if there is no previous one or I am actually on another page it should display the third latest blog article
</div>
<div class="cf"></div>
</div>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment