archive.ejs 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. <% switch (type) {
  2. case 'archive':
  3. var last;
  4. page.posts.each(function(post, i){
  5. var year = post.date.year();
  6. if (last != year){
  7. if (last != null){ %>
  8. </div></section>
  9. <% }
  10. last = year; %>
  11. <div class="archive-year-wrap">
  12. <a href="<%- url_for('archives/' + year) %>" class="archive-year"><%= year %></a>
  13. </div>
  14. <section class="archives-wrap">
  15. <div class="archives">
  16. <% } %>
  17. <%- partial('archive-post', {post: post, archive: true}) %>
  18. <% });
  19. if (page.posts.length){ %>
  20. </div></section>
  21. <% }
  22. if (page.total > 1){ %>
  23. <nav id="page-nav">
  24. <%- paginator({
  25. prev_text: '&laquo; ' + __('nav.prev'),
  26. next_text: __('nav.next') + ' &raquo;'
  27. }) %>
  28. </nav>
  29. <% }
  30. break;
  31. case 'category': %>
  32. <section class="archives-wrap">
  33. <div class="archive-category-wrap">
  34. <span class="archive-category"><%= page.category %></span>
  35. </div>
  36. <div class="archives">
  37. <% page.posts.each(function (post, i) { %>
  38. <%- partial('archive-post', {post: post, archive: false}) %>
  39. <% }); %>
  40. </div></section>
  41. <% if (page.total > 1){ %>
  42. <nav id="page-nav">
  43. <%- paginator({
  44. prev_text: '&laquo; ' + __('nav.prev'),
  45. next_text: __('nav.next') + ' &raquo;'
  46. }) %>
  47. </nav>
  48. <% }
  49. break;
  50. case 'tag': %>
  51. <section class="archives-wrap">
  52. <div class="archive-tag-wrap">
  53. <span class="archive-tag">#<%= page.tag %></span>
  54. </div>
  55. <div class="archives">
  56. <% page.posts.each(function (post, i) { %>
  57. <%- partial('archive-post', {post: post, archive: false}) %>
  58. <% }); %>
  59. </div></section>
  60. <% if (page.total > 1){ %>
  61. <nav id="page-nav">
  62. <%- paginator({
  63. prev_text: '&laquo; ' + __('nav.prev'),
  64. next_text: __('nav.next') + ' &raquo;'
  65. }) %>
  66. </nav>
  67. <% }
  68. break;
  69. default:
  70. page.posts.each(function(post){ %>
  71. <%- partial('article', {post: post, index: true}) %>
  72. <% })
  73. if (page.total > 1){ %>
  74. <nav id="page-nav">
  75. <%- paginator({
  76. prev_text: '&laquo; ' + __('nav.prev'),
  77. next_text: __('nav.next') + ' &raquo;'
  78. }) %>
  79. </nav>
  80. <% }
  81. break;
  82. } %>