root/blog/view_posts.tt
[%- IF prev_link OR next_link;
meta.title = 'Posts in ' _ date.month_name _ ' ' _ date.year;
ELSIF tag;
meta.title = 'Posts tagged \'' _ tag _ '\'';
ELSE;
meta.title = 'Recent posts';
END;
-%]
<section class="box article-list">
[%- IF blog_posts.count == 0 %]
<p>
No [% IF page AND page != 0 %]more [% END %] blog posts to display
[%- IF prev_link OR next_link %] for this month[% END -%]
[%- IF tag %] with this tag[% END -%].
</p>
[%- END %]
[%- i = 0 %]
[%- FOREACH post IN blog_posts.all %]
<article class="box excerpt">
<div>
<header>
<h3>
<a href="[% c.uri_for( post.posted.year, post.posted.month, post.url_title ) %]">[% post.title | html %]</a>
</h3>
<span class="date">
Posted at [% post.posted.strftime('%H:%M') %] on [% post.posted.day %] [% post.posted.month_abbr %] [% post.posted.year %]
by <a href="[% c.uri_for( '/user', post.author.username ) %]">[% post.author.display_name || post.author.username %]</a>
</span>
</header>
[% IF ( i < 3 );
post.teaser( 3 );
ELSE;
post.teaser();
END;
%]
<p>
[%- IF post.discussion %]
(<a href="[% c.uri_for( post.posted.year, post.posted.month, post.url_title ) %]#comments">[% post.comment_count %] comment[% 's' UNLESS post.comment_count == 1 %]</a>)
[%- ELSE %]
<i>(comments disabled)</i>
[%- END %]
</p>
</div>
</article>
[%- i = i + 1 %]
[%- END %]
</section>
[%- IF prev_link OR next_link # month-by-month view %]
<p>
<a href="[% prev_link %]">« [% prev.month_name %] [% prev.year %]</a>
<a href="[% next_link %]">[% next.month_name %] [% next.year %] »</a>
</p>
[%- ELSE %]
[%
UNLESS blog_posts.count == blog_posts.pager.total_entries;
pager = blog_posts.pager;
INCLUDE 'includes/pager.tt';
END;
%]
[%- END %]
[%- IF tag %]
<p>
View <a href="[% c.uri_for( '/tag', tag ) %]">all content tagged '[% tag %]'</a>
</p>
[%- END %]