From fb0d9c534cdc0613e64b2aa75ed7d64879d5b228 Mon Sep 17 00:00:00 2001 From: xaoxuu Date: Thu, 7 Dec 2023 14:03:41 +0800 Subject: [PATCH] [fix] fix bugs --- layout/_partial/main/article/read_next.ejs | 4 ++-- layout/_partial/widgets/related.ejs | 9 +++------ 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/layout/_partial/main/article/read_next.ejs b/layout/_partial/main/article/read_next.ejs index 79a6124..b025379 100644 --- a/layout/_partial/main/article/read_next.ejs +++ b/layout/_partial/main/article/read_next.ejs @@ -12,8 +12,8 @@ function layoutDiv() { } else if (page.layout === 'wiki' && page.wiki && page.wiki.length > 0) { let proj = theme.wiki.tree[page.wiki]; if (proj) { - let ps = proj.pages.filter(p => p.path == page.path) - if (ps.length > 0) { + let ps = proj.pages?.filter(p => p.path == page.path) + if (ps?.length > 0) { const current_page_number = ps[0].page_number || 0; proj.pages.forEach((p, i) => { if (p.page_number < current_page_number) { diff --git a/layout/_partial/widgets/related.ejs b/layout/_partial/widgets/related.ejs index c87c7f3..ae247fe 100644 --- a/layout/_partial/widgets/related.ejs +++ b/layout/_partial/widgets/related.ejs @@ -9,7 +9,7 @@ function layoutDiv() { if (proj?.related?.length > 0) { proj.related.filter(pid => shelf.includes(pid)).forEach((pid, i) => { let p = tree[pid]; - if (p && p.title !== proj?.title) { + if (p && p.title !== proj?.title && p.homepage) { related.push(p); } }); @@ -25,10 +25,7 @@ function layoutDiv() { el += '' + __('meta.more', title) + ''; el += ''; el += ''; el += ''; }