From c1bb225b5bd64a9aae95fc9fdfe65c8431c0be67 Mon Sep 17 00:00:00 2001 From: "tangly1024.com" Date: Fri, 10 Feb 2023 15:26:36 +0800 Subject: [PATCH] nobelium nav config --- themes/nobelium/components/Nav.js | 25 ++++++++++++++----------- themes/nobelium/config_nobelium.js | 8 +++++++- 2 files changed, 21 insertions(+), 12 deletions(-) diff --git a/themes/nobelium/components/Nav.js b/themes/nobelium/components/Nav.js index 9db2e524..33638b23 100644 --- a/themes/nobelium/components/Nav.js +++ b/themes/nobelium/components/Nav.js @@ -2,8 +2,10 @@ import { useEffect, useRef } from 'react' import Link from 'next/link' import BLOG from '@/blog.config' import { useGlobal } from '@/lib/global' +import CONFIG_NOBELIUM from '../config_nobelium' -const Nav = ({ navBarTitle, fullWidth }) => { +const Nav = props => { + const { navBarTitle, fullWidth } = props const useSticky = !BLOG.autoCollapsedNavBar const navRef = useRef(null) const sentinalRef = useRef([]) @@ -83,25 +85,26 @@ const Nav = ({ navBarTitle, fullWidth }) => {

)} - + - ; + } -const NavBar = (props) => { +const NavBar = props => { const { customNav } = props const { locale } = useGlobal() let links = [ - { id: 2, name: locale.NAV.RSS, to: '/feed', show: true }, - { icon: 'fas fa-search', name: locale.NAV.SEARCH, to: '/search', show: true }, - { icon: 'fas fa-archive', name: locale.NAV.ARCHIVE, to: '/archive', show: true }, - { icon: 'fas fa-folder', name: locale.COMMON.CATEGORY, to: '/category', show: false }, - { icon: 'fas fa-tag', name: locale.COMMON.TAGS, to: '/tag', show: true } + { id: 2, name: locale.NAV.RSS, to: '/feed', show: CONFIG_NOBELIUM.MENU_RSS, target: '_blank' }, + { icon: 'fas fa-search', name: locale.NAV.SEARCH, to: '/search', show: CONFIG_NOBELIUM.MENU_SEARCH }, + { icon: 'fas fa-archive', name: locale.NAV.ARCHIVE, to: '/archive', show: CONFIG_NOBELIUM.MENU_ARCHIVE }, + { icon: 'fas fa-folder', name: locale.COMMON.CATEGORY, to: '/category', show: CONFIG_NOBELIUM.MENU_CATEGORY }, + { icon: 'fas fa-tag', name: locale.COMMON.TAGS, to: '/tag', show: CONFIG_NOBELIUM.MENU_TAG } ] if (customNav) { links = links.concat(customNav) } + console.log(links) return (
    @@ -112,7 +115,7 @@ const NavBar = (props) => { key={link.id} className="block ml-4 text-black dark:text-gray-50 nav" > - + {link.name} @@ -120,7 +123,7 @@ const NavBar = (props) => { )}
- ); + ) } export default Nav diff --git a/themes/nobelium/config_nobelium.js b/themes/nobelium/config_nobelium.js index 74ca2a50..5ceff76c 100644 --- a/themes/nobelium/config_nobelium.js +++ b/themes/nobelium/config_nobelium.js @@ -1,4 +1,10 @@ const CONFIG_NOBELIUM = { - TEST_CONFIG: 'TEST' + + // 菜单配置 + MENU_CATEGORY: false, // 显示分类 + MENU_TAG: true, // 显示标签 + MENU_ARCHIVE: false, // 显示归档 + MENU_SEARCH: true, // 显示搜索 + MENU_RSS: false // 显示订阅 } export default CONFIG_NOBELIUM