%PDF- %PDF-
Direktori : /www/specpages-backup/themes/book/layout/ |
Current File : /www/specpages-backup/themes/book/layout/archive.ejs |
<div class='book-archive'> <!-- Title --> <% if(is_archive()){ %> <h1>Archives</h1> <% } else if(is_category()) { %> <h1>Category - <%= page.category %></h1> <% } else if(is_tag()) { %> <h1>Tag - <%= page.tag %></h1> <% } %> <% if(is_current('archives')) { %> <!-- Split post by year --> <% var years = {}; site.posts.sort('date').reverse().forEach(function(post){ var year = post.date.year() if(years[year]===undefined){ years[year] = []; } years[year].push(post); }); %> <% } else { %> <!-- Split post by year --> <% var years = {}; page.posts.sort('date').reverse().forEach(function(post){ var year = post.date.year() if(years[year]===undefined){ years[year] = []; } years[year].push(post); }); %> <% } %> <% Object.keys(years).reverse().forEach(function(year){ %> <div class="years"> <h2><%= year %></h2> <ul class="archive-list-item"> <% years[year].map(function(post){ %> <li> <span><%= post.date.format('YYYY-MM-DD') %></span> <a href="<%- config.root %><%- post.path %>"> <%- post.title || "Untitled" %> </a> </li> <% }) %> </ul> </div> <% }) %> <% if(!is_current('archives') && page.total > 1) {%> <nav class="pager"> <%- paginator() %> </nav> <% } %> </div>