<%- partial('_partial/bg-cover') %>
<% if (theme.postCalendar) { %> <%- partial('_widget/post-calendar') %> <% } %> <% /** * hashCode function. * * @param str str * @returns {number} */ var hashCode = function (str) { if (!str && str.length === 0) { return 0; } var hash = 0; for (var i = 0, len = str.length; i < len; i++) { hash = ((hash << 5) - hash) + str.charCodeAt(i); hash |= 0; } return hash; }; // init year and month variable. var year = '1970'; var month = '1970-01'; // post feature image. var featureimg = '/medias/featureimages/0.jpg'; var featureImages = theme.featureImages; %>
<% page.posts.each(function(post) { %>
<%# year. %> <% if (date(post.date, 'YYYY') != year) { %> <% year = date(post.date, 'YYYY'); %> <% } %> <%# month. %> <% if (date(post.date, 'YYYY-MM') != month) { %> <% month = date(post.date, 'YYYY-MM'); var m = date(post.date, 'MM') %> <% } %> <%# every day posts. %>
<%- date(post.date, 'YYYY-MM-DD').substring(8, 10) %>
<% if (post.img) { %> <%= post.title %> <% } else { %> <% featureimg = featureImages[Math.abs(hashCode(post.title) % featureImages.length)]; %> <%= post.title %> <% } %> <%= post.title %>
<% if (post.summary && post.summary.length > 0) { %> <%- post.summary %> <% } else { %> <%- strip_html(post.content).substring(0, 120) %> <% } %>
<%= date(post.date, config.date_format) %> <% if (post.categories && post.categories.length > 0) { %> <% post.categories.forEach(category => { %> <% }); %> <% } else if (post.author && post.author.length > 0) { %> <%- post.author %> <% } else { %> <%- config.author %> <% } %>
<% if (post.tags && post.tags.length) { %> <% } %>
<% }); %>
<% if (page.total > 1) { %> <%- partial('_partial/paging') %> <% } %>