2021-06-26 15:02:32 +08:00
|
|
|
<%
|
|
|
|
function layoutDiv() {
|
|
|
|
if (page.layout !== "wiki") {
|
|
|
|
return '';
|
|
|
|
}
|
2021-07-26 22:26:46 +08:00
|
|
|
var related = [];
|
2021-07-04 20:21:31 +08:00
|
|
|
let proj = theme.wiki.projects[page.wiki];
|
2021-07-26 22:26:46 +08:00
|
|
|
if (proj.related && proj.related.length > 0) {
|
|
|
|
proj.related.forEach((pid, i) => {
|
|
|
|
let p = theme.wiki.projects[pid];
|
|
|
|
if (p && p.title !== proj.title && p.index !== false) {
|
|
|
|
related.push(p);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
var el = '';
|
|
|
|
if (related.length > 0) {
|
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">';
|
2021-07-26 22:26:46 +08:00
|
|
|
var title = __('btn.wiki');
|
|
|
|
if (proj.tags && proj.tags[0]) {
|
|
|
|
title = proj.tags[0];
|
2021-07-04 20:21:31 +08:00
|
|
|
}
|
2021-07-26 22:26:46 +08:00
|
|
|
el += '<span class="name">' + __('meta.more', title) + '</span>';
|
|
|
|
el += '</div>';
|
2022-10-25 13:57:31 +08:00
|
|
|
el += '<div class="widget-body related-posts">';
|
2021-07-26 22:26:46 +08:00
|
|
|
related.forEach((p, i) => {
|
|
|
|
// 同一个分组中的其它项目
|
2022-10-25 13:57:31 +08:00
|
|
|
el += '<a class="item wiki" href="' + url_for(p.homepage.path) + '">';
|
|
|
|
el += '<span class="title">' + p.title + '</span>';
|
|
|
|
if (p.description && p.description.length > 0) {
|
|
|
|
el += '<span class="excerpt">' + p.description + '</span>';
|
|
|
|
}
|
2021-07-26 22:26:46 +08:00
|
|
|
el += '</a>';
|
|
|
|
});
|
|
|
|
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() %>
|