recent_posts.ejs 1.1 KB

1234567891011121314151617181920212223
  1. <% if (site.posts.length){ %>
  2. <div class="widget-wrap">
  3. <h3 class="widget-title"><%= __('widget.recents') %></h3>
  4. <div class="widget">
  5. <ul id="recent-post" class="<%= (theme.thumbnail?'':'no-thumbnail') %>">
  6. <% site.posts.sort('date', -1).limit(5).each(function(post){ %>
  7. <li>
  8. <% if(theme.thumbnail == true) { %>
  9. <div class="item-thumbnail">
  10. <%- partial('../_partial/post/thumbnail.ejs', {post: post}) %>
  11. </div>
  12. <% } %>
  13. <div class="item-inner">
  14. <p class="item-category"><%- list_categories(post.categories, {show_count: false, depth:2, class: 'article-category', style: 'none', separator: '<i class="fa fa-angle-right"></i>'}) %></p>
  15. <p class="item-title"><a href="<%- url_for((post.link?post.link:post.path)) %>" class="title"><%= post.title %></a></p>
  16. <p class="item-date"><time datetime="<%= date_xml(post.date) %>" itemprop="datePublished"><%= date(post.date) %></time></p>
  17. </div>
  18. </li>
  19. <% }) %>
  20. </ul>
  21. </div>
  22. </div>
  23. <% } %>