hexo-theme-stellar/layout/_partial/sidebar/widgets/wiki_more.ejs

42 lines
1.2 KiB
Plaintext
Raw Normal View History

2021-06-26 15:02:32 +08:00
<%
function layoutDiv() {
if (page.layout !== "wiki") {
return '';
}
var current_group;
site.pages.filter(function (p) {
return p.layout == "index" && p.title && p.wiki && p.wiki.includes(page.wiki)
}).limit(1).each(function(p) {
current_group = p;
});
if (current_group === undefined || current_group.wiki.length < 1) {
return '';
}
var el = '';
el += '<div class="widget-wrap" id="related">';
2021-07-03 20:49:52 +08:00
el += '<div class="widget-header cap dis-select">';
2021-06-26 15:02:32 +08:00
el += '<span class="name">更多' + current_group.title + '</span>';
el += '</div>';
el += '<div class="widget-body fs14">';
current_group.wiki.forEach((wiki, i) => {
site.pages.filter(function (p) {
return p.wiki == wiki && p.wiki != page.wiki && p.description
}).each(function(post) {
if (post.wiki || post.title) {
el += '<div class="line"></div>'
el += '<a class="reveal wiki" href="' + url_for(post.link || post.path) + '">';
el += post.wiki || post.title;
el += '<div class="excerpt">';
el += post.description;
el += '</div>';
el += '</a>';
}
});
});
el += '</div>';
el += '</div>';
return el;
}
%>
<%- layoutDiv() %>