35 lines
1.0 KiB
Plaintext
35 lines
1.0 KiB
Plaintext
<%
|
|
function layoutDiv() {
|
|
if (page.layout !== "wiki") {
|
|
return '';
|
|
}
|
|
let thisItemObject = theme.wiki.tree[page.wiki];
|
|
if (thisItemObject == null) {
|
|
return '';
|
|
}
|
|
const relatedItems = thisItemObject.relatedItems;
|
|
var el = '';
|
|
for (let relatedItem of relatedItems) {
|
|
el += '<widget class="widget-wrapper related">';
|
|
el += '<div class="widget-header cap theme dis-select">';
|
|
el += '<span class="name">' + __('meta.more', relatedItem.name) + '</span>';
|
|
el += '</div>';
|
|
el += '<div class="widget-body related-posts">';
|
|
for (let id of relatedItem.items) {
|
|
// 同一个分组中的其它项目
|
|
let item = theme.wiki.tree[id];
|
|
el += '<a class="item wiki" href="' + url_for(item.homepage?.path) + '">';
|
|
el += '<span class="title">' + item.title + '</span>';
|
|
if (item.description && item.description.length > 0) {
|
|
el += '<span class="excerpt">' + item.description + '</span>';
|
|
}
|
|
el += '</a>';
|
|
}
|
|
el += '</div>';
|
|
el += '</widget>';
|
|
}
|
|
return el;
|
|
}
|
|
%>
|
|
<%- layoutDiv() %>
|