sbbs/themes/hueman/layout/widget/recent_posts.ejs

23 lines
1.3 KiB
Plaintext
Raw Permalink Normal View History

2018-09-03 07:41:16 +00:00
<% if (site.posts.length) { %>
<div class="widget-wrap">
<h3 class="widget-title"><%= __('sidebar.recents') %></h3>
<div class="widget">
<ul id="recent-post" class="<%= (theme.customize.thumbnail?'':'no-thumbnail') %>">
<% site.posts.sort('date', -1).limit(5).each(function(post) { %>
<li>
<% if (theme.customize.thumbnail === true) { %>
<div class="item-thumbnail">
<%- partial('common/thumbnail.ejs', {post: post}) %>
</div>
<% } %>
<div class="item-inner">
<p class="item-category"><%- list_categories(post.categories, {show_count: false, depth:2, class: 'article-category', style: 'none', separator: '<i class="icon fa fa-angle-right"></i>'}) %></p>
<p class="item-title"><a href="<%- url_for((post.link?post.link:post.path)) %>" class="title"><%= post.title %></a></p>
<p class="item-date"><time datetime="<%= date_xml(post.date) %>" itemprop="datePublished"><%= date(post.date) %></time></p>
</div>
</li>
<% }) %>
</ul>
</div>
</div>
<% } %>