[fix] fix bugs
This commit is contained in:
parent
02d7a59dd7
commit
fb0d9c534c
|
@ -12,8 +12,8 @@ function layoutDiv() {
|
||||||
} else if (page.layout === 'wiki' && page.wiki && page.wiki.length > 0) {
|
} else if (page.layout === 'wiki' && page.wiki && page.wiki.length > 0) {
|
||||||
let proj = theme.wiki.tree[page.wiki];
|
let proj = theme.wiki.tree[page.wiki];
|
||||||
if (proj) {
|
if (proj) {
|
||||||
let ps = proj.pages.filter(p => p.path == page.path)
|
let ps = proj.pages?.filter(p => p.path == page.path)
|
||||||
if (ps.length > 0) {
|
if (ps?.length > 0) {
|
||||||
const current_page_number = ps[0].page_number || 0;
|
const current_page_number = ps[0].page_number || 0;
|
||||||
proj.pages.forEach((p, i) => {
|
proj.pages.forEach((p, i) => {
|
||||||
if (p.page_number < current_page_number) {
|
if (p.page_number < current_page_number) {
|
||||||
|
|
|
@ -9,7 +9,7 @@ function layoutDiv() {
|
||||||
if (proj?.related?.length > 0) {
|
if (proj?.related?.length > 0) {
|
||||||
proj.related.filter(pid => shelf.includes(pid)).forEach((pid, i) => {
|
proj.related.filter(pid => shelf.includes(pid)).forEach((pid, i) => {
|
||||||
let p = tree[pid];
|
let p = tree[pid];
|
||||||
if (p && p.title !== proj?.title) {
|
if (p && p.title !== proj?.title && p.homepage) {
|
||||||
related.push(p);
|
related.push(p);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -25,10 +25,7 @@ function layoutDiv() {
|
||||||
el += '<span class="name">' + __('meta.more', title) + '</span>';
|
el += '<span class="name">' + __('meta.more', title) + '</span>';
|
||||||
el += '</div>';
|
el += '</div>';
|
||||||
el += '<div class="widget-body related-posts">';
|
el += '<div class="widget-body related-posts">';
|
||||||
related.forEach((p, i) => {
|
for (let p of related) {
|
||||||
if (p.homepage == null) {
|
|
||||||
console.error("未找到首页:", p.title);
|
|
||||||
}
|
|
||||||
// 同一个分组中的其它项目
|
// 同一个分组中的其它项目
|
||||||
el += '<a class="item wiki" href="' + url_for(p.homepage?.path) + '">';
|
el += '<a class="item wiki" href="' + url_for(p.homepage?.path) + '">';
|
||||||
el += '<span class="title">' + p.title + '</span>';
|
el += '<span class="title">' + p.title + '</span>';
|
||||||
|
@ -36,7 +33,7 @@ function layoutDiv() {
|
||||||
el += '<span class="excerpt">' + p.description + '</span>';
|
el += '<span class="excerpt">' + p.description + '</span>';
|
||||||
}
|
}
|
||||||
el += '</a>';
|
el += '</a>';
|
||||||
});
|
}
|
||||||
el += '</div>';
|
el += '</div>';
|
||||||
el += '</widget>';
|
el += '</widget>';
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue