hexo-theme-stellar/layout/index.ejs

37 lines
923 B
Plaintext
Raw Normal View History

2021-02-19 23:33:19 +08:00
<%
2021-07-26 22:26:46 +08:00
if (page.menu_id == undefined) {
2024-01-14 16:42:20 +08:00
page.menu_id = 'post';
2021-02-19 23:33:19 +08:00
}
2021-02-21 13:44:11 +08:00
if (page.title && page.wiki) {
page.robots = 'noindex,follow';
}
2021-02-27 17:15:47 +08:00
2021-07-04 20:21:31 +08:00
function layout_post_card(layout, post, content) {
2021-02-27 17:15:47 +08:00
var el = '';
var layout = layout;
2022-11-05 00:13:32 +08:00
if (layout == 'post' && post.cover != undefined && post.poster != undefined) {
layout += ' photo';
}
2024-01-19 01:05:44 +08:00
el += `<a class="post-card${scrollreveal(' ')} ${layout}" href="${url_for(post.link || post.path)}">`
2021-02-27 17:15:47 +08:00
el += content;
el += '</a>';
2021-02-27 17:15:47 +08:00
return el;
}
2023-12-17 19:39:23 +08:00
function layout_post_list(partial) {
2021-02-27 17:15:47 +08:00
var el = '';
el += '<div class="post-list post">';
2024-01-19 23:19:48 +08:00
page.posts.each(function(post){
el += layout_post_card('post', post, partial(post));
})
2021-02-27 17:15:47 +08:00
el += '</div>';
return el;
}
2021-02-19 23:33:19 +08:00
%>
2021-02-27 17:15:47 +08:00
2024-01-14 16:42:20 +08:00
<%- 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') %>