From dae9a259a30fbcf466464f330f5185b736840bbb Mon Sep 17 00:00:00 2001 From: Giresharu Date: Tue, 18 Jul 2023 13:45:19 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E8=87=AA=E5=AE=9A=E4=B9=89po?= =?UTF-8?q?st-index=E6=A0=87=E7=AD=BE=E4=B8=8D=E9=AB=98=E4=BA=AE=E9=97=AE?= =?UTF-8?q?=E9=A2=98=20(#304)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- layout/_partial/main/navbar/list_post.ejs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/layout/_partial/main/navbar/list_post.ejs b/layout/_partial/main/navbar/list_post.ejs index a0e5ecc..8dab20c 100644 --- a/layout/_partial/main/navbar/list_post.ejs +++ b/layout/_partial/main/navbar/list_post.ejs @@ -40,7 +40,9 @@ function layoutDiv() { if (theme['post-index']) { const obj = theme['post-index']; for (let key of Object.keys(obj)) { - if (full_url_for(page.path) == full_url_for(obj[key])) { + // 当 page 的末尾为 index.html 或者处于该 page 的某个子页面时也应该匹配 + // if (full_url_for(page.path) == full_url_for(obj[key])) { + if (full_url_for(page.path).startsWith(full_url_for(obj[key]))){ el += '' + key + ''; } else { el += '' + key + ''; @@ -54,4 +56,4 @@ function layoutDiv() { } %> -<%- layoutDiv() %> +<%- layoutDiv() %> \ No newline at end of file