42 lines
1.2 KiB
Plaintext
42 lines
1.2 KiB
Plaintext
<%
|
|
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">';
|
|
el += '<div class="widget-header h4 dis-select">';
|
|
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() %>
|