2021-06-26 15:02:32 +08:00
|
|
|
<%
|
|
|
|
function layoutDiv() {
|
|
|
|
if (page.layout !== "wiki") {
|
|
|
|
return '';
|
|
|
|
}
|
2023-12-17 19:39:23 +08:00
|
|
|
let thisItemObject = theme.wiki.tree[page.wiki];
|
|
|
|
if (thisItemObject == null) {
|
|
|
|
return '';
|
2021-07-26 22:26:46 +08:00
|
|
|
}
|
2023-12-17 19:39:23 +08:00
|
|
|
const relatedItems = thisItemObject.relatedItems;
|
2021-07-26 22:26:46 +08:00
|
|
|
var el = '';
|
2023-12-17 19:39:23 +08:00
|
|
|
for (let relatedItem of relatedItems) {
|
2022-11-23 21:54:21 +08:00
|
|
|
el += '<widget class="widget-wrapper related">';
|
2022-10-25 13:57:31 +08:00
|
|
|
el += '<div class="widget-header cap theme dis-select">';
|
2023-12-17 19:39:23 +08:00
|
|
|
el += '<span class="name">' + __('meta.more', relatedItem.name) + '</span>';
|
2021-07-26 22:26:46 +08:00
|
|
|
el += '</div>';
|
2022-10-25 13:57:31 +08:00
|
|
|
el += '<div class="widget-body related-posts">';
|
2023-12-17 19:39:23 +08:00
|
|
|
for (let id of relatedItem.items) {
|
2021-07-26 22:26:46 +08:00
|
|
|
// 同一个分组中的其它项目
|
2023-12-17 19:39:23 +08:00
|
|
|
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>';
|
2022-10-25 13:57:31 +08:00
|
|
|
}
|
2021-07-26 22:26:46 +08:00
|
|
|
el += '</a>';
|
2023-12-07 14:03:41 +08:00
|
|
|
}
|
2021-07-26 22:26:46 +08:00
|
|
|
el += '</div>';
|
2022-11-23 21:54:21 +08:00
|
|
|
el += '</widget>';
|
2021-07-04 20:21:31 +08:00
|
|
|
}
|
2021-06-26 15:02:32 +08:00
|
|
|
return el;
|
|
|
|
}
|
|
|
|
%>
|
|
|
|
<%- layoutDiv() %>
|