diff --git a/themes/nav/config.js b/themes/nav/config.js
index 29a97c24..48ca7d31 100755
--- a/themes/nav/config.js
+++ b/themes/nav/config.js
@@ -5,7 +5,7 @@ const CONFIG = {
AUTO_SORT: process.env.NEXT_PUBLIC_GITBOOK_AUTO_SORT || true, // 是否自动按分类名 归组排序文章;自动归组可能会打乱您Notion中的文章顺序
SHOW_TITLE_TEXT: false, // 标题栏显示文本
- USE_CUSTEM_MENU: true, // 使用自定义分组菜单(可支持子菜单,支持自定义分类图标)
+ USE_CUSTOM_MENU: true, // 使用自定义菜单(可支持子菜单,支持自定义分类图标),若为true则显示所有的category分类
// 菜单
MENU_CATEGORY: true, // 显示分类
diff --git a/themes/nav/index.js b/themes/nav/index.js
index 2621d76a..d84c6030 100755
--- a/themes/nav/index.js
+++ b/themes/nav/index.js
@@ -1,29 +1,18 @@
'use client'
import CONFIG from './config'
-import { useRouter } from 'next/router'
import { useEffect, useState, createContext, useContext } from 'react'
-import { isBrowser } from '@/lib/utils'
import Footer from './components/Footer'
-import InfoCard from './components/InfoCard'
-import RevolverMaps from './components/RevolverMaps'
import TopNavBar from './components/TopNavBar'
-import SearchInput from './components/SearchInput'
import { useGlobal } from '@/lib/global'
-import Live2D from '@/components/Live2D'
import BLOG from '@/blog.config'
-import NavPostList from './components/NavPostList'
-import ArticleInfo from './components/ArticleInfo'
-import Catalog from './components/Catalog'
import Announcement from './components/Announcement'
import PageNavDrawer from './components/PageNavDrawer'
import FloatTocButton from './components/FloatTocButton'
import { AdSlot } from '@/components/GoogleAdsense'
import JumpToTopButton from './components/JumpToTopButton'
-import ShareBar from '@/components/ShareBar'
import CategoryItem from './components/CategoryItem'
import TagItemMini from './components/TagItemMini'
-import ArticleAround from './components/ArticleAround'
import Comment from '@/components/Comment'
import TocDrawer from './components/TocDrawer'
import NotionPage from '@/components/NotionPage'
@@ -33,14 +22,12 @@ import { Style } from './style'
import CommonHead from '@/components/CommonHead'
import BlogArchiveItem from './components/BlogArchiveItem'
import BlogPostListAll from './components/BlogPostListAll'
-import BlogPostListPage from './components/BlogPostListPage'
import BlogPostCard from './components/BlogPostCard'
-import LogoBar from './components/LogoBar'
import Link from 'next/link'
import dynamic from 'next/dynamic'
-const WWAds = dynamic(() => import('@/components/WWAds'), { ssr: false })
import { MenuItem } from './components/MenuItem'
+const WWAds = dynamic(() => import('@/components/WWAds'), { ssr: false })
// 主题全局变量
const ThemeGlobalNav = createContext()
@@ -53,9 +40,8 @@ export const useNavGlobal = () => useContext(ThemeGlobalNav)
* @constructor
*/
const LayoutBase = (props) => {
- const { customMenu, children, post, allNavPages, categoryOptions, slotLeft, slotRight, slotTop, meta } = props
+ const { customMenu, children, post, allNavPages, categoryOptions, slotLeft, slotTop, meta } = props
const { onLoading } = useGlobal()
- const router = useRouter()
const [tocVisible, changeTocVisible] = useState(false)
const [pageNavVisible, changePageNavVisible] = useState(false)
const [filteredNavPages, setFilteredNavPages] = useState(allNavPages)
@@ -67,133 +53,55 @@ const LayoutBase = (props) => {
}, [post])
let links = customMenu
- // let categoryOptions = filteredNavPages
+
+ if (!CONFIG.USE_CUSTOM_MENU) {
+ links = categoryOptions && categoryOptions?.map(c => {
+ return { id: c.name, title: `# ${c.name}`, to: `/category/${c.name}`, show: true }
+ })
+ }
return (
+ {/* HEAD */}
- {/*
-
- */}
+ {/* 样式 */}
+ {/* 主题样式根基 */}
- {/* 顶部导航栏 */}
+
+ {/* 端顶部导航栏 */}
-
a
-
+ {/* 左右布局区块 */}
+
- {/* 左侧图标Logo */}
-
-
-
{/* 左侧推拉抽屉 */}
-
+
-
+
+ {/* 嵌入 */}
{slotLeft}
+
- {/* 所有文章列表 */}
- {CONFIG.USE_CUSTEM_MENU && links && links?.map((link, index) =>
)}
- {/* {!CONFIG.USE_CUSTEM_MENU &&
} */}
- {/* {links && links?.map((link, index) => {
-
- })} */}
-
- {/* href={`/category/${category.name}`} */}
- {!CONFIG.USE_CUSTEM_MENU && categoryOptions && categoryOptions?.map(category => {
- // let selected = currentCategory === category.name
- let selected = false;
- return (
-
-
-
{category.name}({category.count})
-
-
- )
- })}
+ {/* 显示菜单 */}
+ {links && links?.map((link, index) =>
)}
+ {/* 页脚站点信息 */}
+ {/* 右侧主要内容区块 */}
{slotTop}
+ {/* 广告植入 */}
{
- {/* 右侧侧推拉抽屉 */}
- {/*
-
-
-
-
-
- {slotRight}
- {router.route === '/' && <>
-
- {CONFIG.WIDGET_REVOLVER_MAPS === 'true' &&
}
-
- >}*/}
- {/* onenav主题首页只显示公告 */}
- {/*
-
-
-
-
-
-
-
*/}
-
{/* 移动端悬浮目录按钮 */}
@@ -257,15 +142,11 @@ const LayoutBase = (props) => {
{/* 移动端导航抽屉 */}
- {/* 移动端底部导航栏 */}
- {/*
*/}
-
)
}
-
/**
* 首页
* @param {*} props
@@ -291,22 +172,13 @@ const LayoutPostListIndex = props => {
)
}
-/**
- * 首页
- * @param {*} props
- * @returns 此主题首页就是列表
- */
-const LayoutIndexNew = props => {
- return
-}
-
/**
* 文章列表
* @param {*} props
* @returns
*/
const LayoutPostList = props => {
- const { posts, category, tag } = props
+ const { posts } = props
// 顶部如果是按照分类或标签查看文章列表,列表顶部嵌入一个横幅
// 如果是搜索,则列表顶部嵌入 搜索框
return (
@@ -322,53 +194,13 @@ const LayoutPostList = props => {
)
}
-/**
- * 首页
- * 重定向到某个文章详情页
- * @param {*} props
- * @returns
- */
-const LayoutIndexCustemPage = (props) => {
- const router = useRouter()
- useEffect(() => {
- router.push(CONFIG.INDEX_PAGE).then(() => {
- // console.log('跳转到指定首页', CONFIG.INDEX_PAGE)
- setTimeout(() => {
- if (isBrowser) {
- const article = document.getElementById('notion-article')
- if (!article) {
- console.log('请检查您的Notion数据库中是否包含此slug页面: ', CONFIG.INDEX_PAGE)
- const containerInner = document.querySelector('#theme-onenav #container-inner')
- const newHTML = `
配置有误
请在您的notion中添加一个slug为${CONFIG.INDEX_PAGE}的文章
`
- containerInner?.insertAdjacentHTML('afterbegin', newHTML)
- }
- }
- }, 7 * 1000)
- })
- }, [])
-
- return
-}
-
-/**
- * 文章列表 无
- * 全靠页面导航
- * @param {*} props
- * @returns
- */
-const LayoutPostListOld = (props) => {
- return
-
-
-}
-
/**
* 文章详情
* @param {*} props
* @returns
*/
const LayoutSlug = (props) => {
- const { post, prev, next, lock, validPassword } = props
+ const { post, lock, validPassword } = props
return (