%
if (page.menu_id == undefined) {
page.menu_id = 'post';
}
if (page.title && page.wiki) {
page.robots = 'noindex,follow';
}
function layout_post_card(layout, post, content) {
var el = '';
var layout = layout;
if (layout == 'post' && post.cover != undefined && post.poster != undefined) {
layout += ' photo';
}
el += '';
el += content;
el += '';
return el;
}
function layout_post_list(partial) {
var el = '';
el += '
';
if (is_home()) {
// pinned posts
if (page.current == 1) {
var pinned = site.posts.filter(post => post.pin != undefined).sort((config.index_generator && config.index_generator.order_by) || '-date');
pinned.forEach((post, i) => {
el += layout_post_card('post', post, partial(post));
});
}
// unpinned posts
page.posts.each(function(post){
if (post.pin == undefined) {
el += layout_post_card('post', post, partial(post));
}
})
} else {
page.posts.each(function(post){
el += layout_post_card('post', post, partial(post));
})
}
el += '
';
return el;
}
%>
<%- partial('_partial/main/navbar/nav_tabs_blog') %>
<%- layout_post_list(function(post){
return partial('_partial/main/post_list/post_card', {post: post})
}) %>
<%- partial('_partial/main/post_list/paginator') %>