整理主题配置文件

This commit is contained in:
tangly1024.com
2023-07-06 12:24:25 +08:00
parent b27e62b293
commit 46b9ea1ba2
31 changed files with 99 additions and 96 deletions

View File

@@ -3,7 +3,7 @@ import BLOG from '@/blog.config'
import { useGlobal } from '@/lib/global'
import { useRouter } from 'next/router'
import Link from 'next/link'
import CONFIG_EXAMPLE from '../config_example'
import CONFIG from '../config'
import BlogPostCard from './BlogPostCard'
export const BlogListPage = props => {
@@ -17,7 +17,7 @@ export const BlogListPage = props => {
const showNext = page < totalPage
const pagePrefix = router.asPath.split('?')[0].replace(/\/page\/[1-9]\d*/, '').replace(/\/$/, '')
const showPageCover = CONFIG_EXAMPLE.POST_LIST_COVER
const showPageCover = CONFIG.POST_LIST_COVER
return (
<div className={`w-full ${showPageCover ? 'md:pr-2' : 'md:pr-12'} mb-12`}>

View File

@@ -3,7 +3,7 @@ import { useGlobal } from '@/lib/global'
import React, { useEffect } from 'react'
import throttle from 'lodash.throttle'
import BlogPostCard from './BlogPostCard'
import CONFIG_EXAMPLE from '../config_example'
import CONFIG from '../config'
export const BlogListScroll = props => {
const { posts } = props
@@ -35,7 +35,7 @@ export const BlogListScroll = props => {
handleGetMore()
}
}, 500))
const showPageCover = CONFIG_EXAMPLE.POST_LIST_COVER
const showPageCover = CONFIG.POST_LIST_COVER
useEffect(() => {
window.addEventListener('scroll', scrollTrigger)

View File

@@ -1,10 +1,10 @@
import BLOG from '@/blog.config'
import CONFIG_EXAMPLE from '../config_example'
import CONFIG from '../config'
import Link from 'next/link'
import TwikooCommentCount from '@/components/TwikooCommentCount'
const BlogPostCard = ({ post }) => {
const showPageCover = CONFIG_EXAMPLE.POST_LIST_COVER && post?.pageCoverThumbnail
const showPageCover = CONFIG.POST_LIST_COVER && post?.pageCoverThumbnail
return <article className={`${showPageCover ? 'flex md:flex-row flex-col-reverse' : ''} replace mb-12 `}>
<div className={`${showPageCover ? 'md:w-7/12' : ''}`}>

View File

@@ -1,6 +1,6 @@
import BLOG from '@/blog.config'
import { useGlobal } from '@/lib/global'
import CONFIG_EXAMPLE from '../config_example'
import CONFIG from '../config'
import { MenuItemDrop } from './MenuItemDrop'
/**
@@ -13,10 +13,10 @@ export const Nav = (props) => {
const { locale } = useGlobal()
let links = [
{ id: 1, icon: 'fas fa-search', name: locale.NAV.SEARCH, to: '/search', show: CONFIG_EXAMPLE.MENU_SEARCH },
{ id: 2, icon: 'fas fa-archive', name: locale.NAV.ARCHIVE, to: '/archive', show: CONFIG_EXAMPLE.MENU_ARCHIVE },
{ id: 3, icon: 'fas fa-folder', name: locale.COMMON.CATEGORY, to: '/category', show: CONFIG_EXAMPLE.MENU_CATEGORY },
{ id: 4, icon: 'fas fa-tag', name: locale.COMMON.TAGS, to: '/tag', show: CONFIG_EXAMPLE.MENU_TAG }
{ id: 1, icon: 'fas fa-search', name: locale.NAV.SEARCH, to: '/search', show: CONFIG.MENU_SEARCH },
{ id: 2, icon: 'fas fa-archive', name: locale.NAV.ARCHIVE, to: '/archive', show: CONFIG.MENU_ARCHIVE },
{ id: 3, icon: 'fas fa-folder', name: locale.COMMON.CATEGORY, to: '/category', show: CONFIG.MENU_CATEGORY },
{ id: 4, icon: 'fas fa-tag', name: locale.COMMON.TAGS, to: '/tag', show: CONFIG.MENU_TAG }
]
if (customNav) {

View File

@@ -1,4 +1,7 @@
const CONFIG_EXAMPLE = {
/**
* 主题配置文件
*/
const CONFIG = {
// 菜单配置
MENU_CATEGORY: true, // 显示分类
MENU_TAG: true, // 显示标签
@@ -8,4 +11,4 @@ const CONFIG_EXAMPLE = {
POST_LIST_COVER: true // 列表显示文章封面
}
export default CONFIG_EXAMPLE
export default CONFIG

View File

@@ -1,7 +1,7 @@
'use client'
import BLOG from '@/blog.config'
import CONFIG_EXAMPLE from './config_example'
import CONFIG from './config'
import CommonHead from '@/components/CommonHead'
import { useEffect } from 'react'
import { Header } from './components/Header'
@@ -244,7 +244,7 @@ const LayoutTagIndex = (props) => {
}
export {
CONFIG_EXAMPLE as THEME_CONFIG,
CONFIG as THEME_CONFIG,
LayoutIndex,
LayoutPostList,
LayoutSearch,

View File

@@ -10,7 +10,7 @@ import { useRouter } from 'next/router'
import DarkModeButton from '@/components/DarkModeButton'
import SocialButton from './SocialButton'
import { useFukasawaGlobal } from '..'
import FUKA_CONFIG from '@/themes/fukasawa/config_fuka'
import CONFIG from '@/themes/fukasawa/config'
// import { debounce } from 'lodash'
// import { useEffect } from 'react'
@@ -55,7 +55,7 @@ function AsideLeft(props) {
return <div className={`sideLeft relative ${isCollapsed ? 'w-0' : 'w-80'} ease-in-out duration-150 transition-all bg-white dark:bg-hexo-black-gray min-h-screen hidden lg:block z-20`}>
{/* 折叠按钮 */}
{FUKA_CONFIG.SIDEBAR_COLLAPSE_BUTTON && <div className={`${isCollapsed ? '' : 'ml-80'} hidden lg:block sticky top-0 mx-2 cursor-pointer hover:scale-110 duration-150 px-3 py-2`} onClick={toggleOpen}>
{CONFIG.SIDEBAR_COLLAPSE_BUTTON && <div className={`${isCollapsed ? '' : 'ml-80'} hidden lg:block sticky top-0 mx-2 cursor-pointer hover:scale-110 duration-150 px-3 py-2`} onClick={toggleOpen}>
{isCollapsed ? <i className="fa-solid fa-indent text-xl"></i> : <i className='fas fa-bars text-xl'></i>}
</div>}

View File

@@ -2,7 +2,7 @@ import BLOG from '@/blog.config'
import Link from 'next/link'
import TagItemMini from './TagItemMini'
import React from 'react'
import CONFIG_FUKA from '../config_fuka'
import CONFIG_FUKA from '../config'
const BlogCard = ({ index, post, showSummary, siteInfo }) => {
const showPreview = CONFIG_FUKA.POST_LIST_PREVIEW && post.blockMap

View File

@@ -1,5 +1,5 @@
import { useGlobal } from '@/lib/global'
import CONFIG_FUKA from '../config_fuka'
import CONFIG_FUKA from '../config'
import BLOG from '@/blog.config'
import { MenuItemDrop } from './MenuItemDrop'
import { MenuItemCollapse } from './MenuItemCollapse'

View File

@@ -1,4 +1,4 @@
const FUKA_CONFIG = {
const CONFIG = {
POST_LIST_COVER: true, // 文章列表显示图片封面
POST_LIST_COVER_FORCE: false, // 即使没有封面也将站点背景图设置为封面
@@ -14,4 +14,4 @@ const FUKA_CONFIG = {
SIDEBAR_COLLAPSE_SATUS_DEFAULT: false // 侧边栏默认折叠收起
}
export default FUKA_CONFIG
export default CONFIG

View File

@@ -1,6 +1,6 @@
'use client'
import FUKA_CONFIG from './config_fuka'
import CONFIG from './config'
import CommonHead from '@/components/CommonHead'
import TopNav from './components/TopNav'
import AsideLeft from './components/AsideLeft'
@@ -46,9 +46,9 @@ const LayoutBase = (props) => {
// 侧边栏折叠从 本地存储中获取 open 状态的初始值
const [isCollapsed, setIsCollapse] = useState(() => {
if (typeof window !== 'undefined') {
return localStorage.getItem('fukasawa-sidebar-collapse') === 'true' || FUKA_CONFIG.SIDEBAR_COLLAPSE_SATUS_DEFAULT
return localStorage.getItem('fukasawa-sidebar-collapse') === 'true' || CONFIG.SIDEBAR_COLLAPSE_SATUS_DEFAULT
}
return FUKA_CONFIG.SIDEBAR_COLLAPSE_SATUS_DEFAULT
return CONFIG.SIDEBAR_COLLAPSE_SATUS_DEFAULT
})
// 在组件卸载时保存 open 状态到本地存储中
@@ -252,7 +252,7 @@ const LayoutTagIndex = (props) => {
}
export {
FUKA_CONFIG as THEME_CONFIG,
CONFIG as THEME_CONFIG,
LayoutIndex,
LayoutSearch,
LayoutArchive,

View File

@@ -1,6 +1,6 @@
import React from 'react'
import { useGlobal } from '@/lib/global'
import CONFIG_GITBOOK from '../config_gitbook'
import CONFIG from '../config'
import BLOG from '@/blog.config'
import { MenuItemCollapse } from './MenuItemCollapse'
@@ -10,10 +10,10 @@ export const MenuBarMobile = (props) => {
let links = [
// { name: locale.NAV.INDEX, to: '/' || '/', show: true },
{ name: locale.COMMON.CATEGORY, to: '/category', show: CONFIG_GITBOOK.MENU_CATEGORY },
{ name: locale.COMMON.TAGS, to: '/tag', show: CONFIG_GITBOOK.MENU_TAG },
{ name: locale.NAV.ARCHIVE, to: '/archive', show: CONFIG_GITBOOK.MENU_ARCHIVE }
// { name: locale.NAV.SEARCH, to: '/search', show: CONFIG_GITBOOK.MENU_SEARCH }
{ name: locale.COMMON.CATEGORY, to: '/category', show: CONFIG.MENU_CATEGORY },
{ name: locale.COMMON.TAGS, to: '/tag', show: CONFIG.MENU_TAG },
{ name: locale.NAV.ARCHIVE, to: '/archive', show: CONFIG.MENU_ARCHIVE }
// { name: locale.NAV.SEARCH, to: '/search', show: CONFIG.MENU_SEARCH }
]
if (customNav) {

View File

@@ -3,7 +3,7 @@ import { useRef, useState } from 'react'
import Collapse from '@/components/Collapse'
import { MenuBarMobile } from './MenuBarMobile'
import { useGlobal } from '@/lib/global'
import CONFIG_GITBOOK from '../config_gitbook'
import CONFIG from '../config'
import BLOG from '@/blog.config'
import { MenuItemDrop } from './MenuItemDrop'
import DarkModeButton from '@/components/DarkModeButton'
@@ -21,10 +21,10 @@ export default function TopNavBar(props) {
const { locale } = useGlobal()
const defaultLinks = [
{ icon: 'fas fa-th', name: locale.COMMON.CATEGORY, to: '/category', show: CONFIG_GITBOOK.MENU_CATEGORY },
{ icon: 'fas fa-tag', name: locale.COMMON.TAGS, to: '/tag', show: CONFIG_GITBOOK.MENU_TAG },
{ icon: 'fas fa-archive', name: locale.NAV.ARCHIVE, to: '/archive', show: CONFIG_GITBOOK.MENU_ARCHIVE },
{ icon: 'fas fa-search', name: locale.NAV.SEARCH, to: '/search', show: CONFIG_GITBOOK.MENU_SEARCH }
{ icon: 'fas fa-th', name: locale.COMMON.CATEGORY, to: '/category', show: CONFIG.MENU_CATEGORY },
{ icon: 'fas fa-tag', name: locale.COMMON.TAGS, to: '/tag', show: CONFIG.MENU_TAG },
{ icon: 'fas fa-archive', name: locale.NAV.ARCHIVE, to: '/archive', show: CONFIG.MENU_ARCHIVE },
{ icon: 'fas fa-search', name: locale.NAV.SEARCH, to: '/search', show: CONFIG.MENU_SEARCH }
]
let links = defaultLinks.concat(customNav)

View File

@@ -1,4 +1,4 @@
const CONFIG_GITBOOK = {
const CONFIG = {
INDEX_PAGE: 'about', // 文档首页显示的文章请确此路径包含在您的notion数据库中
@@ -12,4 +12,4 @@ const CONFIG_GITBOOK = {
WIDGET_REVOLVER_MAPS: process.env.NEXT_PUBLIC_WIDGET_REVOLVER_MAPS || 'false', // 地图插件
WIDGET_TO_TOP: true // 跳回顶部
}
export default CONFIG_GITBOOK
export default CONFIG

View File

@@ -1,4 +1,4 @@
import CONFIG_GITBOOK from './config_gitbook'
import CONFIG from './config'
import { useRouter } from 'next/router'
import { useEffect, useState, createContext, useContext } from 'react'
import { isBrowser } from '@/lib/utils'
@@ -119,7 +119,7 @@ const LayoutBase = (props) => {
{slotRight}
{router.route === '/' && <>
<InfoCard {...props} />
{CONFIG_GITBOOK.WIDGET_REVOLVER_MAPS === 'true' && <RevolverMaps />}
{CONFIG.WIDGET_REVOLVER_MAPS === 'true' && <RevolverMaps />}
<Live2D />
</>}
{/* gitbook主题首页只显示公告 */}
@@ -157,15 +157,15 @@ const LayoutBase = (props) => {
*/
const LayoutIndex = (props) => {
const router = useRouter()
router.push(CONFIG_GITBOOK.INDEX_PAGE).then(() => {
// console.log('跳转到指定首页', CONFIG_GITBOOK.INDEX_PAGE)
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_GITBOOK.INDEX_PAGE)
console.log('请检查您的Notion数据库中是否包含此slug页面 ', CONFIG.INDEX_PAGE)
const containerInner = document.getElementById('container-inner')
const newHTML = `<h1 class="text-3xl pt-12 dark:text-gray-300">配置有误</h1><blockquote class="notion-quote notion-block-ce76391f3f2842d386468ff1eb705b92"><div>请在您的notion中添加一个slug为${CONFIG_GITBOOK.INDEX_PAGE}的文章</div></blockquote>`
const newHTML = `<h1 class="text-3xl pt-12 dark:text-gray-300">配置有误</h1><blockquote class="notion-quote notion-block-ce76391f3f2842d386468ff1eb705b92"><div>请在您的notion中添加一个slug为${CONFIG.INDEX_PAGE}的文章</div></blockquote>`
containerInner?.insertAdjacentHTML('afterbegin', newHTML)
}
}
@@ -214,9 +214,9 @@ const LayoutSlug = (props) => {
<ShareBar post={post} />
{/* 文章分类和标签信息 */}
<div className='flex justify-between'>
{CONFIG_GITBOOK.POST_DETAIL_CATEGORY && post?.category && <CategoryItem category={post.category} />}
{CONFIG.POST_DETAIL_CATEGORY && post?.category && <CategoryItem category={post.category} />}
<div>
{CONFIG_GITBOOK.POST_DETAIL_TAG && post?.tagItems?.map(tag => <TagItemMini key={tag.name} tag={tag} />)}
{CONFIG.POST_DETAIL_TAG && post?.tagItems?.map(tag => <TagItemMini key={tag.name} tag={tag} />)}
</div>
</div>
@@ -277,7 +277,7 @@ const LayoutTagIndex = (props) => {
}
export {
CONFIG_GITBOOK as THEME_CONFIG,
CONFIG as THEME_CONFIG,
LayoutIndex,
LayoutSearch,
LayoutArchive,

View File

@@ -1,5 +1,5 @@
import Link from 'next/link'
import CONFIG_HEXO from '../config_hexo'
import CONFIG from '../config'
/**
* 上一篇,下一篇文章
@@ -7,7 +7,7 @@ import CONFIG_HEXO from '../config_hexo'
* @returns
*/
export default function ArticleAdjacent ({ prev, next }) {
if (!prev || !next || !CONFIG_HEXO.ARTICLE_ADJACENT) {
if (!prev || !next || !CONFIG.ARTICLE_ADJACENT) {
return <></>
}
return (
@@ -29,5 +29,5 @@ export default function ArticleAdjacent ({ prev, next }) {
</Link>
</section>
);
)
}

View File

@@ -3,10 +3,10 @@ import { useGlobal } from '@/lib/global'
import Link from 'next/link'
import { useRouter } from 'next/router'
import { useEffect, useState } from 'react'
import CONFIG_HEXO from '../config_hexo'
import CONFIG from '../config'
export default function ArticleCopyright () {
if (!CONFIG_HEXO.ARTICLE_COPYRIGHT) {
if (!CONFIG.ARTICLE_COPYRIGHT) {
return <></>
}
const router = useRouter()

View File

@@ -1,5 +1,5 @@
import Link from 'next/link'
import CONFIG_HEXO from '../config_hexo'
import CONFIG from '../config'
import BLOG from '@/blog.config'
import { useGlobal } from '@/lib/global'
@@ -12,7 +12,7 @@ export default function ArticleRecommend({ recommendPosts, siteInfo }) {
const { locale } = useGlobal()
if (
!CONFIG_HEXO.ARTICLE_RECOMMEND ||
!CONFIG.ARTICLE_RECOMMEND ||
!recommendPosts ||
recommendPosts.length === 0
) {

View File

@@ -1,21 +1,21 @@
import Link from 'next/link'
import React from 'react'
import CONFIG_HEXO from '../config_hexo'
import CONFIG from '../config'
import { BlogPostCardInfo } from './BlogPostCardInfo'
import BLOG from '@/blog.config'
// import Image from 'next/image'
const BlogPostCard = ({ index, post, showSummary, siteInfo }) => {
const showPreview = CONFIG_HEXO.POST_LIST_PREVIEW && post.blockMap
if (post && !post.pageCoverThumbnail && CONFIG_HEXO.POST_LIST_COVER_DEFAULT) {
const showPreview = CONFIG.POST_LIST_PREVIEW && post.blockMap
if (post && !post.pageCoverThumbnail && CONFIG.POST_LIST_COVER_DEFAULT) {
post.pageCover = siteInfo?.pageCoverThumbnail
}
const showPageCover = CONFIG_HEXO.POST_LIST_COVER && post?.pageCoverThumbnail && !showPreview
const showPageCover = CONFIG.POST_LIST_COVER && post?.pageCoverThumbnail && !showPreview
// const delay = (index % 2) * 200
return (
<div className={`${CONFIG_HEXO.POST_LIST_COVER_HOVER_ENLARGE ? ' hover:scale-110 transition-all duration-150' : ''}`} >
<div className={`${CONFIG.POST_LIST_COVER_HOVER_ENLARGE ? ' hover:scale-110 transition-all duration-150' : ''}`} >
<div
data-aos="fade-up"
data-aos-easing="ease-in-out"
@@ -24,7 +24,7 @@ const BlogPostCard = ({ index, post, showSummary, siteInfo }) => {
data-aos-anchor-placement="top-bottom"
id='blog-post-card'
key={post.id}
className={`md:h-56 w-full flex justify-between md:flex-row flex-col-reverse ${CONFIG_HEXO.POST_LIST_IMG_CROSSOVER && index % 2 === 1 ? 'md:flex-row-reverse' : ''}
className={`md:h-56 w-full flex justify-between md:flex-row flex-col-reverse ${CONFIG.POST_LIST_IMG_CROSSOVER && index % 2 === 1 ? 'md:flex-row-reverse' : ''}
overflow-hidden border dark:border-black rounded-xl bg-white dark:bg-hexo-black-gray`}>
{/* 文字内容 */}

View File

@@ -3,7 +3,7 @@ import BlogPostCard from './BlogPostCard'
import BlogPostListEmpty from './BlogPostListEmpty'
import { useGlobal } from '@/lib/global'
import React from 'react'
import CONFIG_HEXO from '../config_hexo'
import CONFIG from '../config'
import { getListByPage } from '@/lib/utils'
/**
@@ -13,7 +13,7 @@ import { getListByPage } from '@/lib/utils'
* @returns {JSX.Element}
* @constructor
*/
const BlogPostListScroll = ({ posts = [], currentSearch, showSummary = CONFIG_HEXO.POST_LIST_SUMMARY, siteInfo }) => {
const BlogPostListScroll = ({ posts = [], currentSearch, showSummary = CONFIG.POST_LIST_SUMMARY, siteInfo }) => {
const postsPerPage = BLOG.POSTS_PER_PAGE
const [page, updatePage] = React.useState(1)
const postsToShow = getListByPage(posts, page, postsPerPage)

View File

@@ -1,11 +1,11 @@
import { useGlobal } from '@/lib/global'
import { saveDarkModeToCookies } from '@/themes/theme'
import CONFIG_HEXO from '../config_hexo'
import CONFIG from '../config'
export default function FloatDarkModeButton () {
const { isDarkMode, updateDarkMode } = useGlobal()
if (!CONFIG_HEXO.WIDGET_DARK_MODE) {
if (!CONFIG.WIDGET_DARK_MODE) {
return <></>
}

View File

@@ -1,7 +1,7 @@
// import Image from 'next/image'
import { useEffect, useState } from 'react'
import Typed from 'typed.js'
import CONFIG_HEXO from '../config_hexo'
import CONFIG from '../config'
import NavButtonGroup from './NavButtonGroup'
import { useGlobal } from '@/lib/global'
import BLOG from '@/blog.config'
@@ -63,7 +63,7 @@ const Hero = props => {
</div>
{/* 首页导航大按钮 */}
{CONFIG_HEXO.HOME_NAV_BUTTONS && <NavButtonGroup {...props} />}
{CONFIG.HOME_NAV_BUTTONS && <NavButtonGroup {...props} />}
{/* 滚动按钮 */}
<div onClick={scrollToWrapper} className="z-10 cursor-pointer w-full text-center py-4 text-3xl absolute bottom-10 text-white">
@@ -73,7 +73,7 @@ const Hero = props => {
</div>
<div id='header-cover' style={{ backgroundImage: `url('${siteInfo.pageCover}')` }}
className={`header-cover bg-center w-full h-screen bg-cover ${CONFIG_HEXO.HOME_NAV_BACKGROUND_IMG_FIXED ? 'bg-fixed' : ''}`} />
className={`header-cover bg-center w-full h-screen bg-cover ${CONFIG.HOME_NAV_BACKGROUND_IMG_FIXED ? 'bg-fixed' : ''}`} />
</header>
)

View File

@@ -1,5 +1,5 @@
import React from 'react'
import CONFIG_HEXO from '../config_hexo'
import CONFIG from '../config'
/**
* 跳转到评论区
@@ -7,7 +7,7 @@ import CONFIG_HEXO from '../config_hexo'
* @constructor
*/
const JumpToCommentButton = () => {
if (!CONFIG_HEXO.WIDGET_TO_COMMENT) {
if (!CONFIG.WIDGET_TO_COMMENT) {
return <></>
}

View File

@@ -1,6 +1,6 @@
import { useGlobal } from '@/lib/global'
import React from 'react'
import CONFIG_HEXO from '../config_hexo'
import CONFIG from '../config'
/**
* 跳转到网页顶部
@@ -13,7 +13,7 @@ import CONFIG_HEXO from '../config_hexo'
const JumpToTopButton = ({ showPercent = true, percent }) => {
const { locale } = useGlobal()
if (!CONFIG_HEXO.WIDGET_TO_TOP) {
if (!CONFIG.WIDGET_TO_TOP) {
return <></>
}
return (<div className='space-x-1 items-center justify-center transform hover:scale-105 duration-200 w-7 h-auto pb-1 text-center' onClick={() => window.scrollTo({ top: 0, behavior: 'smooth' })} >

View File

@@ -1,7 +1,7 @@
import React from 'react'
import Link from 'next/link'
import { useGlobal } from '@/lib/global'
import CONFIG_HEXO from '../config_hexo'
import CONFIG from '../config'
const MenuGroupCard = (props) => {
const { postCount, categoryOptions, tagOptions } = props
@@ -11,9 +11,9 @@ const MenuGroupCard = (props) => {
const tagSlot = <div className='text-center'>{tagOptions?.length}</div>
const links = [
{ name: locale.COMMON.ARTICLE, to: '/archive', slot: archiveSlot, show: CONFIG_HEXO.MENU_ARCHIVE },
{ name: locale.COMMON.CATEGORY, to: '/category', slot: categorySlot, show: CONFIG_HEXO.MENU_CATEGORY },
{ name: locale.COMMON.TAGS, to: '/tag', slot: tagSlot, show: CONFIG_HEXO.MENU_TAG }
{ name: locale.COMMON.ARTICLE, to: '/archive', slot: archiveSlot, show: CONFIG.MENU_ARCHIVE },
{ name: locale.COMMON.CATEGORY, to: '/category', slot: categorySlot, show: CONFIG.MENU_CATEGORY },
{ name: locale.COMMON.TAGS, to: '/tag', slot: tagSlot, show: CONFIG.MENU_TAG }
]
return (

View File

@@ -2,17 +2,17 @@ import React from 'react'
import { useGlobal } from '@/lib/global'
import BLOG from '@/blog.config'
import { MenuItemCollapse } from './MenuItemCollapse'
import CONFIG_HEXO from '../config_hexo'
import CONFIG from '../config'
export const MenuListSide = (props) => {
const { customNav, customMenu } = props
const { locale } = useGlobal()
let links = [
{ icon: 'fas fa-archive', name: locale.NAV.ARCHIVE, to: '/archive', show: CONFIG_HEXO.MENU_ARCHIVE },
{ icon: 'fas fa-search', name: locale.NAV.SEARCH, to: '/search', show: CONFIG_HEXO.MENU_SEARCH },
{ icon: 'fas fa-folder', name: locale.COMMON.CATEGORY, to: '/category', show: CONFIG_HEXO.MENU_CATEGORY },
{ icon: 'fas fa-tag', name: locale.COMMON.TAGS, to: '/tag', show: CONFIG_HEXO.MENU_TAG }
{ icon: 'fas fa-archive', name: locale.NAV.ARCHIVE, to: '/archive', show: CONFIG.MENU_ARCHIVE },
{ icon: 'fas fa-search', name: locale.NAV.SEARCH, to: '/search', show: CONFIG.MENU_SEARCH },
{ icon: 'fas fa-folder', name: locale.COMMON.CATEGORY, to: '/category', show: CONFIG.MENU_CATEGORY },
{ icon: 'fas fa-tag', name: locale.COMMON.TAGS, to: '/tag', show: CONFIG.MENU_TAG }
]
if (customNav) {

View File

@@ -1,6 +1,6 @@
import React from 'react'
import { useGlobal } from '@/lib/global'
import CONFIG_HEXO from '../config_hexo'
import CONFIG from '../config'
import BLOG from '@/blog.config'
import { MenuItemDrop } from './MenuItemDrop'
@@ -9,11 +9,11 @@ export const MenuListTop = (props) => {
const { locale } = useGlobal()
let links = [
{ id: 1, icon: 'fa-solid fa-house', name: locale.NAV.INDEX, to: '/', show: CONFIG_HEXO.MENU_INDEX },
{ id: 2, icon: 'fas fa-search', name: locale.NAV.SEARCH, to: '/search', show: CONFIG_HEXO.MENU_SEARCH },
{ id: 3, icon: 'fas fa-archive', name: locale.NAV.ARCHIVE, to: '/archive', show: CONFIG_HEXO.MENU_ARCHIVE }
// { icon: 'fas fa-folder', name: locale.COMMON.CATEGORY, to: '/category', show: CONFIG_HEXO.MENU_CATEGORY },
// { icon: 'fas fa-tag', name: locale.COMMON.TAGS, to: '/tag', show: CONFIG_HEXO.MENU_TAG }
{ id: 1, icon: 'fa-solid fa-house', name: locale.NAV.INDEX, to: '/', show: CONFIG.MENU_INDEX },
{ id: 2, icon: 'fas fa-search', name: locale.NAV.SEARCH, to: '/search', show: CONFIG.MENU_SEARCH },
{ id: 3, icon: 'fas fa-archive', name: locale.NAV.ARCHIVE, to: '/archive', show: CONFIG.MENU_ARCHIVE }
// { icon: 'fas fa-folder', name: locale.COMMON.CATEGORY, to: '/category', show: CONFIG.MENU_CATEGORY },
// { icon: 'fas fa-tag', name: locale.COMMON.TAGS, to: '/tag', show: CONFIG.MENU_TAG }
]
if (customNav) {

View File

@@ -5,7 +5,7 @@ import TagGroups from './TagGroups'
import Catalog from './Catalog'
import { InfoCard } from './InfoCard'
import { AnalyticsCard } from './AnalyticsCard'
import CONFIG_HEXO from '../config_hexo'
import CONFIG from '../config'
import BLOG from '@/blog.config'
import dynamic from 'next/dynamic'
import Announcement from './Announcement'
@@ -41,7 +41,7 @@ export default function SideRight(props) {
return (
<div id='sideRight' className={'space-y-4 lg:w-80 lg:pt-0 px-2 pt-4'}>
<InfoCard {...props} />
{CONFIG_HEXO.WIDGET_ANALYTICS && <AnalyticsCard {...props} />}
{CONFIG.WIDGET_ANALYTICS && <AnalyticsCard {...props} />}
{showCategory && (
<Card>
@@ -59,7 +59,7 @@ export default function SideRight(props) {
<TagGroups tags={tags} currentTag={currentTag} />
</Card>
)}
{CONFIG_HEXO.WIDGET_LATEST_POSTS && latestPosts && latestPosts.length > 0 && <Card>
{CONFIG.WIDGET_LATEST_POSTS && latestPosts && latestPosts.length > 0 && <Card>
<LatestPostsGroup {...props} />
</Card>}

View File

@@ -1,6 +1,6 @@
import { useGlobal } from '@/lib/global'
import React from 'react'
import CONFIG_HEXO from '../config_hexo'
import CONFIG from '../config'
/**
* 点击召唤目录抽屉
@@ -11,7 +11,7 @@ import CONFIG_HEXO from '../config_hexo'
*/
const TocDrawerButton = (props) => {
const { locale } = useGlobal()
if (!CONFIG_HEXO.WIDGET_TOC) {
if (!CONFIG.WIDGET_TOC) {
return <></>
}
return (<div onClick={props.onClick} className='py-2 px-3 cursor-pointer transform duration-200 flex justify-center items-center w-7 h-7 text-center' title={locale.POST.TOP} >

View File

@@ -1,4 +1,4 @@
const CONFIG_HEXO = {
const CONFIG = {
HOME_BANNER_ENABLE: true,
// 3.14.1以后的版本中欢迎语在blog.config.js中配置用英文逗号','隔开多个。
HOME_BANNER_GREETINGS: ['Hi我是一个程序员', 'Hi我是一个打工人', 'Hi我是一个干饭人', '欢迎来到我的博客🎉'], // 首页大图标语文字
@@ -33,4 +33,4 @@ const CONFIG_HEXO = {
WIDGET_DARK_MODE: true, // 夜间模式
WIDGET_TOC: true // 移动端悬浮目录
}
export default CONFIG_HEXO
export default CONFIG

View File

@@ -1,4 +1,4 @@
import CONFIG_HEXO from './config_hexo'
import CONFIG from './config'
import CommonHead from '@/components/CommonHead'
import { useEffect, useRef } from 'react'
@@ -72,7 +72,7 @@ const LayoutBase = props => {
</Transition>
{/* 主区块 */}
<main id="wrapper" className={`${CONFIG_HEXO.HOME_BANNER_ENABLE ? '' : 'pt-16'} bg-hexo-background-gray dark:bg-black w-full py-8 md:px-8 lg:px-24 min-h-screen relative`}>
<main id="wrapper" className={`${CONFIG.HOME_BANNER_ENABLE ? '' : 'pt-16'} bg-hexo-background-gray dark:bg-black w-full py-8 md:px-8 lg:px-24 min-h-screen relative`}>
<div id="container-inner" className={(BLOG.LAYOUT_SIDEBAR_REVERSE ? 'flex-row-reverse' : '') + ' w-full mx-auto lg:flex lg:space-x-4 justify-center relative z-10'} >
<div className={`${className || ''} w-full max-w-4xl h-full `}>
@@ -115,7 +115,7 @@ const LayoutBase = props => {
* @returns
*/
const LayoutIndex = (props) => {
const headerSlot = CONFIG_HEXO.HOME_BANNER_ENABLE && <Hero {...props} />
const headerSlot = CONFIG.HOME_BANNER_ENABLE && <Hero {...props} />
return <LayoutPostList {...props} headerSlot={headerSlot} className='pt-8' />
}
@@ -352,7 +352,7 @@ const LayoutTagIndex = props => {
}
export {
CONFIG_HEXO as THEME_CONFIG,
CONFIG as THEME_CONFIG,
LayoutIndex,
LayoutSearch,
LayoutArchive,