From beb5f3d348d31e285f098f4a44a37e138f4c5516 Mon Sep 17 00:00:00 2001 From: calfzhou Date: Tue, 19 Nov 2024 15:42:47 +0800 Subject: [PATCH] fix(notebooks): fix bug in notebooks generator - `notebooks.tree` is an object, not array (#543) --- scripts/generators/notebooks.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/generators/notebooks.js b/scripts/generators/notebooks.js index f5fa101..989fb9e 100644 --- a/scripts/generators/notebooks.js +++ b/scripts/generators/notebooks.js @@ -30,7 +30,7 @@ function paginationWithEmpty(base, posts, options={}) { hexo.extend.generator.register('notebooks', function (locals) { const { site_tree, notebooks } = hexo.theme.config - if (notebooks.tree.length === undefined) { + if (!notebooks?.tree || Object.keys(notebooks.tree).length === 0) { return [] }