diff --git a/lib/notion/getNotionData.js b/lib/notion/getNotionData.js
index 5a247f8c..91aa029e 100644
--- a/lib/notion/getNotionData.js
+++ b/lib/notion/getNotionData.js
@@ -182,7 +182,7 @@ export function getNavPages({ allPages }) {
const allNavPages = allPages.filter(post => {
return post && post?.slug && (!post?.slug?.startsWith('http')) && post?.type === 'Post' && post?.status === 'Published'
})
- const result = allNavPages.map(item => ({ id: item.id, title: item.title || null, category: item.category || null, tags: item.tags || null, summary: item.summary || null, slug: item.slug }))
+ const result = allNavPages.map(item => ({ id: item.id, title: item.title || '', category: item.category || null, tags: item.tags || null, summary: item.summary || null, slug: item.slug }))
const groupedArray = result.reduce((groups, item) => {
const categoryName = item.category ? item.category.join('/') : '' // 将category转换为字符串
diff --git a/themes/gitbook/components/BlogPostCard.js b/themes/gitbook/components/BlogPostCard.js
index bb47fcc2..b481aec4 100644
--- a/themes/gitbook/components/BlogPostCard.js
+++ b/themes/gitbook/components/BlogPostCard.js
@@ -10,7 +10,7 @@ const BlogPostCard = ({ post, className }) => {
diff --git a/themes/gitbook/components/NavPostItem.js b/themes/gitbook/components/NavPostItem.js
index 5ddc7ecf..4d1637e9 100644
--- a/themes/gitbook/components/NavPostItem.js
+++ b/themes/gitbook/components/NavPostItem.js
@@ -17,22 +17,26 @@ const NavPostItem = (props) => {
changeIsOpen(!isOpen)
}
- if (group.category) {
- return <>
+ if (group?.category) {
+ return
-
{group.category}
+ className='flex justify-between text-sm font-sans cursor-pointer p-2 hover:bg-gray-50 rounded-md dark:hover:bg-gray-600' key={group?.category}>
+
{group?.category}
- {group.items?.map(post => (
+ {group?.items?.map(post => (
))
}
- >
+
} else {
- return {group.items?.map(post => ())}
+ return
+ {group?.items?.map(post => (
+
))
+ }
+
}
}
diff --git a/themes/gitbook/components/NavPostList.js b/themes/gitbook/components/NavPostList.js
index 0cb8c3bf..7e793871 100644
--- a/themes/gitbook/components/NavPostList.js
+++ b/themes/gitbook/components/NavPostList.js
@@ -1,7 +1,6 @@
import NavPostListEmpty from './NavPostListEmpty'
import { useRouter } from 'next/router'
import NavPostItem from './NavPostItem'
-import { useGitBookGlobal } from '..'
/**
* 博客列表滚动分页
@@ -11,13 +10,13 @@ import { useGitBookGlobal } from '..'
* @constructor
*/
const NavPostList = (props) => {
- const { filteredPosts } = useGitBookGlobal()
+ const { filteredPosts } = props
const router = useRouter()
let selectedSth = false
// 处理是否选中
- filteredPosts.map((group) => {
+ filteredPosts?.map((group) => {
let groupSelected = false
for (const post of group?.items) {
if (router.asPath.split('?')[0] === '/' + post.slug) {
diff --git a/themes/gitbook/components/PageNavDrawer.js b/themes/gitbook/components/PageNavDrawer.js
index 5f872184..4cad9448 100644
--- a/themes/gitbook/components/PageNavDrawer.js
+++ b/themes/gitbook/components/PageNavDrawer.js
@@ -10,6 +10,7 @@ import NavPostList from './NavPostList'
*/
const PageNavDrawer = (props) => {
const { pageNavVisible, changePageNavVisible } = useGitBookGlobal()
+ const { filteredPosts } = props
const switchVisible = () => {
changePageNavVisible(!pageNavVisible)
}
@@ -22,7 +23,7 @@ const PageNavDrawer = (props) => {
' overflow-y-hidden shadow-card w-72 duration-200 fixed left-1 top-16 rounded py-2 bg-white dark:bg-gray-600'}>
{/* 所有文章列表 */}
-
+
diff --git a/themes/gitbook/index.js b/themes/gitbook/index.js
index b38afbc2..0d059de6 100644
--- a/themes/gitbook/index.js
+++ b/themes/gitbook/index.js
@@ -71,10 +71,10 @@ const LayoutBase = (props) => {
{slotLeft}
{/* 所有文章列表 */}
-
+
-
+
@@ -84,6 +84,7 @@ const LayoutBase = (props) => {
}
{/* 移动端导航抽屉 */}
-
+
{/* 移动端底部导航栏 */}
{/* */}
@@ -177,7 +178,7 @@ const LayoutIndex = (props) => {
})
}, [])
- return
+ return
}
/**
@@ -187,7 +188,7 @@ const LayoutIndex = (props) => {
* @returns
*/
const LayoutPostList = (props) => {
- return
+ return
}
/**