mirror of
https://github.com/d0zingcat/NotionNext.git
synced 2026-05-22 23:16:48 +00:00
主题配置文件Notion化
This commit is contained in:
@@ -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.POST_LIST_COVER
|
||||
const showPageCover = siteConfig('EXAMPLE_POST_LIST_COVER', null, CONFIG)
|
||||
|
||||
return (
|
||||
<div className={`w-full ${showPageCover ? 'md:pr-2' : 'md:pr-12'} mb-12`}>
|
||||
|
||||
@@ -35,7 +35,7 @@ export const BlogListScroll = props => {
|
||||
handleGetMore()
|
||||
}
|
||||
}, 500))
|
||||
const showPageCover = CONFIG.POST_LIST_COVER
|
||||
const showPageCover = siteConfig('EXAMPLE_POST_LIST_COVER', null, CONFIG)
|
||||
|
||||
useEffect(() => {
|
||||
window.addEventListener('scroll', scrollTrigger)
|
||||
|
||||
@@ -5,7 +5,7 @@ import TwikooCommentCount from '@/components/TwikooCommentCount'
|
||||
import LazyImage from '@/components/LazyImage'
|
||||
|
||||
const BlogPostCard = ({ post }) => {
|
||||
const showPageCover = CONFIG.POST_LIST_COVER && post?.pageCoverThumbnail
|
||||
const showPageCover = siteConfig('EXAMPLE_POST_LIST_COVER', null, CONFIG) && post?.pageCoverThumbnail
|
||||
|
||||
return <article className={`${showPageCover ? 'flex md:flex-row flex-col-reverse' : ''} replace mb-12 `}>
|
||||
<div className={`${showPageCover ? 'md:w-7/12' : ''}`}>
|
||||
|
||||
@@ -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.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 }
|
||||
{ id: 1, icon: 'fas fa-search', name: locale.NAV.SEARCH, to: '/search', show: siteConfig('EXAMPLE_MENU_SEARCH', null, CONFIG) },
|
||||
{ id: 2, icon: 'fas fa-archive', name: locale.NAV.ARCHIVE, to: '/archive', show: siteConfig('EXAMPLE_MENU_ARCHIVE', null, CONFIG) },
|
||||
{ id: 3, icon: 'fas fa-folder', name: locale.COMMON.CATEGORY, to: '/category', show: siteConfig('EXAMPLE_MENU_CATEGORY', null, CONFIG) },
|
||||
{ id: 4, icon: 'fas fa-tag', name: locale.COMMON.TAGS, to: '/tag', show: siteConfig('EXAMPLE_MENU_TAG', null, CONFIG) }
|
||||
]
|
||||
|
||||
if (customNav) {
|
||||
|
||||
@@ -3,12 +3,12 @@
|
||||
*/
|
||||
const CONFIG = {
|
||||
// 菜单配置
|
||||
MENU_CATEGORY: true, // 显示分类
|
||||
MENU_TAG: true, // 显示标签
|
||||
MENU_ARCHIVE: true, // 显示归档
|
||||
MENU_SEARCH: true, // 显示搜索
|
||||
EXAMPLE_MENU_CATEGORY: true, // 显示分类
|
||||
EXAMPLE_MENU_TAG: true, // 显示标签
|
||||
EXAMPLE_MENU_ARCHIVE: true, // 显示归档
|
||||
EXAMPLE_MENU_SEARCH: true, // 显示搜索
|
||||
|
||||
POST_LIST_COVER: true // 列表显示文章封面
|
||||
EXAMPLE_POST_LIST_COVER: true // 列表显示文章封面
|
||||
|
||||
}
|
||||
export default CONFIG
|
||||
|
||||
@@ -54,7 +54,7 @@ function AsideLeft(props) {
|
||||
|
||||
return <div className={`sideLeft relative ${isCollapsed ? 'w-0' : 'w-80'} duration-150 transition-all bg-white dark:bg-hexo-black-gray min-h-screen hidden lg:block z-20`}>
|
||||
{/* 折叠按钮 */}
|
||||
{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}>
|
||||
{siteConfig('FUKASAWA_SIDEBAR_COLLAPSE_BUTTON', null, CONFIG) && <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>}
|
||||
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
import { siteConfig } from '@/lib/config'
|
||||
import Link from 'next/link'
|
||||
import TagItemMini from './TagItemMini'
|
||||
import CONFIG_FUKA from '../config'
|
||||
import CONFIG from '../config'
|
||||
import LazyImage from '@/components/LazyImage'
|
||||
|
||||
const BlogCard = ({ index, post, showSummary, siteInfo }) => {
|
||||
const showPreview = CONFIG_FUKA.POST_LIST_PREVIEW && post.blockMap
|
||||
const showPreview = siteConfig('FUKASAWA_POST_LIST_PREVIEW', null, CONFIG) && post.blockMap
|
||||
// fukasawa 强制显示图片
|
||||
if (CONFIG_FUKA.POST_LIST_COVER_FORCE && post && !post.pageCover) {
|
||||
if (siteConfig('FUKASAWA_POST_LIST_COVER_FORCE', null, CONFIG) && post && !post.pageCover) {
|
||||
post.pageCoverThumbnail = siteInfo?.pageCover
|
||||
}
|
||||
const showPageCover = CONFIG_FUKA.POST_LIST_COVER && post?.pageCoverThumbnail
|
||||
const showPageCover = siteConfig('FUKASAWA_POST_LIST_COVER', null, CONFIG) && post?.pageCoverThumbnail
|
||||
|
||||
return (
|
||||
<div
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { useGlobal } from '@/lib/global'
|
||||
import CONFIG_FUKA from '../config'
|
||||
import CONFIG from '../config'
|
||||
import { siteConfig } from '@/lib/config'
|
||||
import { MenuItemDrop } from './MenuItemDrop'
|
||||
import { MenuItemCollapse } from './MenuItemCollapse'
|
||||
@@ -10,10 +10,10 @@ export const MenuList = (props) => {
|
||||
|
||||
let links = [
|
||||
{ name: locale.NAV.INDEX, to: '/' || '/', show: true },
|
||||
{ name: locale.COMMON.CATEGORY, to: '/category', show: CONFIG_FUKA.MENU_CATEGORY },
|
||||
{ name: locale.COMMON.TAGS, to: '/tag', show: CONFIG_FUKA.MENU_TAG },
|
||||
{ name: locale.NAV.ARCHIVE, to: '/archive', show: CONFIG_FUKA.MENU_ARCHIVE },
|
||||
{ name: locale.NAV.SEARCH, to: '/search', show: CONFIG_FUKA.MENU_SEARCH }
|
||||
{ name: locale.COMMON.CATEGORY, to: '/category', show: siteConfig('FUKASAWA_MENU_CATEGORY', null, CONFIG) },
|
||||
{ name: locale.COMMON.TAGS, to: '/tag', show: siteConfig('FUKASAWA_MENU_TAG', null, CONFIG) },
|
||||
{ name: locale.NAV.ARCHIVE, to: '/archive', show: siteConfig('FUKASAWA_MENU_ARCHIVE', null, CONFIG) },
|
||||
{ name: locale.NAV.SEARCH, to: '/search', show: siteConfig('FUKASAWA_MENU_SEARCH', null, CONFIG) }
|
||||
]
|
||||
|
||||
if (customNav) {
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
const CONFIG = {
|
||||
|
||||
POST_LIST_COVER: true, // 文章列表显示图片封面
|
||||
POST_LIST_COVER_FORCE: false, // 即使没有封面也将站点背景图设置为封面
|
||||
POST_LIST_PREVIEW: false, // 显示文章预览
|
||||
FUKASAWA_POST_LIST_COVER: true, // 文章列表显示图片封面
|
||||
FUKASAWA_POST_LIST_COVER_FORCE: false, // 即使没有封面也将站点背景图设置为封面
|
||||
FUKASAWA_POST_LIST_PREVIEW: false, // 显示文章预览
|
||||
|
||||
// 菜单
|
||||
MENU_CATEGORY: true, // 显示分类
|
||||
MENU_TAG: true, // 显示标签
|
||||
MENU_ARCHIVE: true, // 显示归档
|
||||
MENU_SEARCH: false, // 显示搜索
|
||||
FUKASAWA_MENU_CATEGORY: true, // 显示分类
|
||||
FUKASAWA_MENU_TAG: true, // 显示标签
|
||||
FUKASAWA_MENU_ARCHIVE: true, // 显示归档
|
||||
FUKASAWA_MENU_SEARCH: false, // 显示搜索
|
||||
|
||||
SIDEBAR_COLLAPSE_BUTTON: true, // 侧边栏折叠按钮
|
||||
SIDEBAR_COLLAPSE_SATUS_DEFAULT: false // 侧边栏默认折叠收起
|
||||
FUKASAWA_SIDEBAR_COLLAPSE_BUTTON: true, // 侧边栏折叠按钮
|
||||
FUKASAWA_SIDEBAR_COLLAPSE_SATUS_DEFAULT: false // 侧边栏默认折叠收起
|
||||
|
||||
}
|
||||
export default CONFIG
|
||||
|
||||
@@ -50,9 +50,9 @@ const LayoutBase = (props) => {
|
||||
// 侧边栏折叠从 本地存储中获取 open 状态的初始值
|
||||
const [isCollapsed, setIsCollapse] = useState(() => {
|
||||
if (typeof window !== 'undefined') {
|
||||
return localStorage.getItem('fukasawa-sidebar-collapse') === 'true' || CONFIG.SIDEBAR_COLLAPSE_SATUS_DEFAULT
|
||||
return localStorage.getItem('fukasawa-sidebar-collapse') === 'true' || siteConfig('FUKASAWA_SIDEBAR_COLLAPSE_SATUS_DEFAULT', null, CONFIG)
|
||||
}
|
||||
return CONFIG.SIDEBAR_COLLAPSE_SATUS_DEFAULT
|
||||
return siteConfig('FUKASAWA_SIDEBAR_COLLAPSE_SATUS_DEFAULT', null, CONFIG)
|
||||
})
|
||||
|
||||
// 在组件卸载时保存 open 状态到本地存储中
|
||||
|
||||
@@ -9,10 +9,10 @@ export const MenuBarMobile = (props) => {
|
||||
|
||||
let links = [
|
||||
// { name: locale.NAV.INDEX, to: '/' || '/', show: true },
|
||||
{ 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 }
|
||||
{ name: locale.COMMON.CATEGORY, to: '/category', show: siteConfig('GITBOOK_MENU_CATEGORY', null, CONFIG) },
|
||||
{ name: locale.COMMON.TAGS, to: '/tag', show: siteConfig('GITBOOK_BOOK_MENU_TAG', null, CONFIG) },
|
||||
{ name: locale.NAV.ARCHIVE, to: '/archive', show: siteConfig('GITBOOK_MENU_ARCHIVE', null, CONFIG) }
|
||||
// { name: locale.NAV.SEARCH, to: '/search', show: siteConfig('MENU_SEARCH', null, CONFIG) }
|
||||
]
|
||||
|
||||
if (customNav) {
|
||||
|
||||
@@ -2,6 +2,7 @@ import NavPostListEmpty from './NavPostListEmpty'
|
||||
import { useRouter } from 'next/router'
|
||||
import NavPostItem from './NavPostItem'
|
||||
import CONFIG from '../config'
|
||||
import { siteConfig } from '@/lib/config'
|
||||
|
||||
/**
|
||||
* 博客列表滚动分页
|
||||
@@ -19,7 +20,7 @@ const NavPostList = (props) => {
|
||||
|
||||
let existingGroup = null
|
||||
// 开启自动分组排序
|
||||
if (JSON.parse(CONFIG.AUTO_SORT)) {
|
||||
if (JSON.parse(siteConfig('GITBOOK_AUTO_SORT', true, CONFIG))) {
|
||||
existingGroup = groups.find(group => group.category === categoryName) // 搜索同名的最后一个分组
|
||||
} else {
|
||||
existingGroup = groups[groups.length - 1] // 获取最后一个分组
|
||||
|
||||
@@ -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.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 }
|
||||
{ icon: 'fas fa-th', name: locale.COMMON.CATEGORY, to: '/category', show: siteConfig('GITBOOK_MENU_CATEGORY', null, CONFIG) },
|
||||
{ icon: 'fas fa-tag', name: locale.COMMON.TAGS, to: '/tag', show: siteConfig('GITBOOK_BOOK_MENU_TAG', null, CONFIG) },
|
||||
{ icon: 'fas fa-archive', name: locale.NAV.ARCHIVE, to: '/archive', show: siteConfig('GITBOOK_MENU_ARCHIVE', null, CONFIG) },
|
||||
{ icon: 'fas fa-search', name: locale.NAV.SEARCH, to: '/search', show: siteConfig('GITBOOK_MENU_SEARCH', null, CONFIG) }
|
||||
]
|
||||
|
||||
let links = defaultLinks.concat(customNav)
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
const CONFIG = {
|
||||
|
||||
INDEX_PAGE: 'about', // 文档首页显示的文章,请确此路径包含在您的notion数据库中
|
||||
GITBOOK_INDEX_PAGE: 'about', // 文档首页显示的文章,请确此路径包含在您的notion数据库中
|
||||
|
||||
AUTO_SORT: process.env.NEXT_PUBLIC_GITBOOK_AUTO_SORT || true, // 是否自动按分类名 归组排序文章;自动归组可能会打乱您Notion中的文章顺序
|
||||
GITBOOK_AUTO_SORT: process.env.NEXT_PUBLIC_GITBOOK_AUTO_SORT || true, // 是否自动按分类名 归组排序文章;自动归组可能会打乱您Notion中的文章顺序
|
||||
|
||||
// 菜单
|
||||
MENU_CATEGORY: true, // 显示分类
|
||||
MENU_TAG: true, // 显示标签
|
||||
MENU_ARCHIVE: true, // 显示归档
|
||||
MENU_SEARCH: true, // 显示搜索
|
||||
GITBOOK_MENU_CATEGORY: true, // 显示分类
|
||||
GITBOOK_BOOK_MENU_TAG: true, // 显示标签
|
||||
GITBOOK_MENU_ARCHIVE: true, // 显示归档
|
||||
GITBOOK_MENU_SEARCH: true, // 显示搜索
|
||||
|
||||
// Widget
|
||||
WIDGET_REVOLVER_MAPS: process.env.NEXT_PUBLIC_WIDGET_REVOLVER_MAPS || 'false', // 地图插件
|
||||
WIDGET_TO_TOP: true // 跳回顶部
|
||||
GITBOOK_WIDGET_REVOLVER_MAPS: process.env.NEXT_PUBLIC_WIDGET_REVOLVER_MAPS || 'false', // 地图插件
|
||||
GITBOOK_WIDGET_TO_TOP: true // 跳回顶部
|
||||
}
|
||||
export default CONFIG
|
||||
|
||||
@@ -133,7 +133,7 @@ const LayoutBase = (props) => {
|
||||
{slotRight}
|
||||
{router.route === '/' && <>
|
||||
<InfoCard {...props} />
|
||||
{CONFIG.WIDGET_REVOLVER_MAPS === 'true' && <RevolverMaps />}
|
||||
{siteConfig('GITBOOK_WIDGET_REVOLVER_MAPS', null, CONFIG) === 'true' && <RevolverMaps />}
|
||||
<Live2D />
|
||||
</>}
|
||||
{/* gitbook主题首页只显示公告 */}
|
||||
@@ -173,15 +173,15 @@ const LayoutBase = (props) => {
|
||||
const LayoutIndex = (props) => {
|
||||
const router = useRouter()
|
||||
useEffect(() => {
|
||||
router.push(CONFIG.INDEX_PAGE).then(() => {
|
||||
// console.log('跳转到指定首页', CONFIG.INDEX_PAGE)
|
||||
router.push(siteConfig('GITBOOK_INDEX_PAGE', null, CONFIG)).then(() => {
|
||||
// console.log('跳转到指定首页', siteConfig('INDEX_PAGE', null, CONFIG))
|
||||
setTimeout(() => {
|
||||
if (isBrowser) {
|
||||
const article = document.getElementById('notion-article')
|
||||
if (!article) {
|
||||
console.log('请检查您的Notion数据库中是否包含此slug页面: ', CONFIG.INDEX_PAGE)
|
||||
console.log('请检查您的Notion数据库中是否包含此slug页面: ', siteConfig('GITBOOK_INDEX_PAGE', null, CONFIG))
|
||||
const containerInner = document.querySelector('#theme-gitbook #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.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为${siteConfig('GITBOOK_INDEX_PAGE', null, CONFIG)}的文章</div></blockquote>`
|
||||
containerInner?.insertAdjacentHTML('afterbegin', newHTML)
|
||||
}
|
||||
}
|
||||
@@ -230,9 +230,9 @@ const LayoutSlug = (props) => {
|
||||
<ShareBar post={post} />
|
||||
{/* 文章分类和标签信息 */}
|
||||
<div className='flex justify-between'>
|
||||
{CONFIG.POST_DETAIL_CATEGORY && post?.category && <CategoryItem category={post.category} />}
|
||||
{siteConfig('POST_DETAIL_CATEGORY', null, CONFIG) && post?.category && <CategoryItem category={post.category} />}
|
||||
<div>
|
||||
{CONFIG.POST_DETAIL_TAG && post?.tagItems?.map(tag => <TagItemMini key={tag.name} tag={tag} />)}
|
||||
{siteConfig('POST_DETAIL_TAG', null, CONFIG) && post?.tagItems?.map(tag => <TagItemMini key={tag.name} tag={tag} />)}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import CONFIG from '../config'
|
||||
import { siteConfig } from '@/lib/config'
|
||||
|
||||
/**
|
||||
* 博客统计卡牌
|
||||
@@ -6,7 +7,7 @@ import CONFIG from '../config'
|
||||
* @returns
|
||||
*/
|
||||
export function AnalyticsCard(props) {
|
||||
const targetDate = new Date(CONFIG.SITE_CREATE_TIME)
|
||||
const targetDate = new Date(siteConfig('HEO_SITE_CREATE_TIME', null, CONFIG))
|
||||
const today = new Date()
|
||||
const diffTime = today.getTime() - targetDate.getTime() // 获取两个日期之间的毫秒数差值
|
||||
const diffDays = Math.ceil(diffTime / (1000 * 60 * 60 * 24)) // 将毫秒数差值转换为天数差值
|
||||
|
||||
@@ -2,6 +2,7 @@ import Link from 'next/link'
|
||||
import { useRouter } from 'next/router'
|
||||
import { useEffect, useState } from 'react'
|
||||
import CONFIG from '../config'
|
||||
import { siteConfig } from '@/lib/config'
|
||||
|
||||
/**
|
||||
* 上一篇,下一篇文章
|
||||
@@ -42,7 +43,7 @@ export default function ArticleAdjacent({ prev, next }) {
|
||||
}
|
||||
}, [])
|
||||
|
||||
if (!prev || !next || !CONFIG.ARTICLE_ADJACENT) {
|
||||
if (!prev || !next || !siteConfig('HEO_ARTICLE_ADJACENT', null, CONFIG)) {
|
||||
return <></>
|
||||
}
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ export default function ArticleCopyright () {
|
||||
|
||||
const { locale } = useGlobal()
|
||||
|
||||
if (!CONFIG.ARTICLE_COPYRIGHT) {
|
||||
if (!siteConfig('HEO_ARTICLE_COPYRIGHT', null, CONFIG)) {
|
||||
return <></>
|
||||
}
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ export default function ArticleRecommend({ recommendPosts, siteInfo }) {
|
||||
const { locale } = useGlobal()
|
||||
|
||||
if (
|
||||
!CONFIG.ARTICLE_RECOMMEND ||
|
||||
!siteConfig('HEO_ARTICLE_RECOMMEND', null, CONFIG) ||
|
||||
!recommendPosts ||
|
||||
recommendPosts.length === 0
|
||||
) {
|
||||
|
||||
@@ -24,11 +24,11 @@ const BlogPostArchive = ({ posts = [], archiveTitle, siteInfo }) => {
|
||||
</div>
|
||||
<ul>
|
||||
{posts?.map(post => {
|
||||
const showPreview = CONFIG.POST_LIST_PREVIEW && post.blockMap
|
||||
if (post && !post.pageCoverThumbnail && CONFIG.POST_LIST_COVER_DEFAULT) {
|
||||
const showPreview = siteConfig('HEO_POST_LIST_PREVIEW', null, CONFIG) && post.blockMap
|
||||
if (post && !post.pageCoverThumbnail && siteConfig('HEO_POST_LIST_COVER_DEFAULT', null, CONFIG)) {
|
||||
post.pageCoverThumbnail = siteInfo?.pageCover
|
||||
}
|
||||
const showPageCover = CONFIG.POST_LIST_COVER && post?.pageCoverThumbnail && !showPreview
|
||||
const showPageCover = siteConfig('HEO_POST_LIST_COVER', null, CONFIG) && post?.pageCoverThumbnail && !showPreview
|
||||
return <div key={post.id} className={'cursor-pointer flex flex-row mb-4 h-24 md:flex-row group w-full dark:border-gray-600 hover:border-indigo-600 dark:hover:border-yellow-600 duration-300 transition-colors justify-between overflow-hidden'}>
|
||||
|
||||
{/* 图片封面 */}
|
||||
|
||||
@@ -5,13 +5,13 @@ import LazyImage from '@/components/LazyImage'
|
||||
import { siteConfig } from '@/lib/config'
|
||||
|
||||
const BlogPostCard = ({ index, post, showSummary, siteInfo }) => {
|
||||
const showPreview = CONFIG.POST_LIST_PREVIEW && post.blockMap
|
||||
if (post && !post.pageCoverThumbnail && CONFIG.POST_LIST_COVER_DEFAULT) {
|
||||
const showPreview = siteConfig('HEO_POST_LIST_PREVIEW', null, CONFIG) && post.blockMap
|
||||
if (post && !post.pageCoverThumbnail && siteConfig('HEO_POST_LIST_COVER_DEFAULT', null, CONFIG)) {
|
||||
post.pageCoverThumbnail = siteInfo?.pageCover
|
||||
}
|
||||
const showPageCover = CONFIG.POST_LIST_COVER && post?.pageCoverThumbnail && !showPreview
|
||||
const showPageCover = siteConfig('HEO_POST_LIST_COVER', null, CONFIG) && post?.pageCoverThumbnail && !showPreview
|
||||
return (
|
||||
<div className={` ${CONFIG.POST_LIST_COVER_HOVER_ENLARGE ? ' hover:scale-110 transition-all duration-150' : ''}`} >
|
||||
<div className={` ${siteConfig('HEO_POST_LIST_COVER_HOVER_ENLARGE', null, CONFIG) ? ' hover:scale-110 transition-all duration-150' : ''}`} >
|
||||
|
||||
<div
|
||||
data-aos="fade-up"
|
||||
|
||||
@@ -13,7 +13,7 @@ import { siteConfig } from '@/lib/config'
|
||||
* @returns {JSX.Element}
|
||||
* @constructor
|
||||
*/
|
||||
const BlogPostListScroll = ({ posts = [], currentSearch, showSummary = CONFIG.POST_LIST_SUMMARY, siteInfo }) => {
|
||||
const BlogPostListScroll = ({ posts = [], currentSearch, showSummary = siteConfig('HEO_POST_LIST_SUMMARY', null, CONFIG), siteInfo }) => {
|
||||
const postsPerPage = parseInt(siteConfig('POSTS_PER_PAGE'))
|
||||
const [page, updatePage] = useState(1)
|
||||
const postsToShow = getListByPage(posts, page, postsPerPage)
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
import { useGlobal } from '@/lib/global'
|
||||
import { saveDarkModeToCookies } from '@/themes/theme'
|
||||
import CONFIG from '../config'
|
||||
import { siteConfig } from '@/lib/config'
|
||||
|
||||
export default function FloatDarkModeButton () {
|
||||
const { isDarkMode, updateDarkMode } = useGlobal()
|
||||
|
||||
if (!CONFIG.WIDGET_DARK_MODE) {
|
||||
if (!siteConfig('HEO_WIDGET_DARK_MODE', null, CONFIG)) {
|
||||
return <></>
|
||||
}
|
||||
|
||||
|
||||
@@ -80,12 +80,12 @@ function Banner(props) {
|
||||
>
|
||||
<div id="banner-title" className="flex flex-col absolute top-10 left-10">
|
||||
<div className="text-4xl font-bold mb-3 dark:text-white">
|
||||
{CONFIG.HERO_TITLE_1}
|
||||
{siteConfig('HEO_HERO_TITLE_1', null, CONFIG)}
|
||||
<br />
|
||||
{CONFIG.HERO_TITLE_2}
|
||||
{siteConfig('HEO_HERO_TITLE_2', null, CONFIG)}
|
||||
</div>
|
||||
<div className="text-xs text-gray-600 dark:text-gray-200">
|
||||
{CONFIG.HERO_TITLE_3}
|
||||
{siteConfig('HEO_HERO_TITLE_3', null, CONFIG)}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -116,7 +116,7 @@ function Banner(props) {
|
||||
* 英雄区左上角banner条中斜向滚动的图标
|
||||
*/
|
||||
function TagsGroupBar() {
|
||||
const groupIcons = CONFIG.GROUP_ICONS.concat(CONFIG.GROUP_ICONS)
|
||||
const groupIcons = siteConfig('HEO_GROUP_ICONS', null, CONFIG).concat(siteConfig('HEO_GROUP_ICONS', null, CONFIG))
|
||||
|
||||
return (
|
||||
<div className="tags-group-all flex -rotate-[30deg] h-full">
|
||||
@@ -166,11 +166,11 @@ function GroupMenu() {
|
||||
return (
|
||||
<div className="h-[165px] select-none xl:h-20 flex flex-col justify-between xl:space-y-0 xl:flex-row w-28 lg:w-48 xl:w-full xl:flex-nowrap xl:space-x-3">
|
||||
<Link
|
||||
href={CONFIG.HERO_CATEGORY_1?.url}
|
||||
href={siteConfig('HEO_HERO_CATEGORY_1', null, CONFIG)?.url}
|
||||
className="group relative overflow-hidden bg-gradient-to-r from-blue-500 to-blue-400 flex h-20 justify-start items-center text-white rounded-xl xl:hover:w-1/2 xl:w-1/3 transition-all duration-500 ease-in"
|
||||
>
|
||||
<div className="font-bold lg:text-lg pl-5 relative -mt-2">
|
||||
{CONFIG.HERO_CATEGORY_1?.title}
|
||||
{siteConfig('HEO_HERO_CATEGORY_1', null, CONFIG)?.title}
|
||||
<span className="absolute -bottom-0.5 left-5 w-5 h-0.5 bg-white rounded-full"></span>
|
||||
</div>
|
||||
<div className="hidden lg:block absolute right-6 duration-700 ease-in-out transition-all scale-[2] translate-y-6 rotate-12 opacity-20 group-hover:opacity-80 group-hover:scale-100 group-hover:translate-y-0 group-hover:rotate-0">
|
||||
@@ -178,11 +178,11 @@ function GroupMenu() {
|
||||
</div>
|
||||
</Link>
|
||||
<Link
|
||||
href={CONFIG.HERO_CATEGORY_2?.url}
|
||||
href={siteConfig('HEO_HERO_CATEGORY_2', null, CONFIG)?.url}
|
||||
className="group relative overflow-hidden bg-gradient-to-r from-red-500 to-yellow-500 flex h-20 justify-start items-center text-white rounded-xl xl:hover:w-1/2 xl:w-1/3 transition-all duration-500 ease-in"
|
||||
>
|
||||
<div className="font-bold lg:text-lg pl-5 relative -mt-2">
|
||||
{CONFIG.HERO_CATEGORY_2?.title}
|
||||
{siteConfig('HEO_HERO_CATEGORY_2', null, CONFIG)?.title}
|
||||
<span className="absolute -bottom-0.5 left-5 w-5 h-0.5 bg-white rounded-full"></span>
|
||||
</div>
|
||||
<div className="hidden lg:block absolute right-6 duration-700 ease-in-out transition-all scale-[2] translate-y-6 rotate-12 opacity-20 group-hover:opacity-80 group-hover:scale-100 group-hover:translate-y-0 group-hover:rotate-0">
|
||||
@@ -191,11 +191,11 @@ function GroupMenu() {
|
||||
</Link>
|
||||
{/* 第三个标签在小屏上不显示 */}
|
||||
<Link
|
||||
href={CONFIG.HERO_CATEGORY_3?.url}
|
||||
href={siteConfig('HEO_HERO_CATEGORY_3', null, CONFIG)?.url}
|
||||
className="group relative overflow-hidden bg-gradient-to-r from-teal-300 to-cyan-300 hidden h-20 xl:flex justify-start items-center text-white rounded-xl xl:hover:w-1/2 xl:w-1/3 transition-all duration-500 ease-in"
|
||||
>
|
||||
<div className="font-bold text-lg pl-5 relative -mt-2">
|
||||
{CONFIG.HERO_CATEGORY_3?.title}
|
||||
{siteConfig('HEO_HERO_CATEGORY_3', null, CONFIG)?.title}
|
||||
<span className="absolute -bottom-0.5 left-5 w-5 h-0.5 bg-white rounded-full"></span>
|
||||
</div>
|
||||
<div className="absolute right-6 duration-700 ease-in-out transition-all scale-[2] translate-y-6 rotate-12 opacity-20 group-hover:opacity-80 group-hover:scale-100 group-hover:translate-y-0 group-hover:rotate-0">
|
||||
@@ -263,8 +263,8 @@ function TopGroup(props) {
|
||||
function getTopPosts({ latestPosts, allNavPages }) {
|
||||
// 默认展示最近更新
|
||||
if (
|
||||
!CONFIG.HERO_RECOMMEND_POST_TAG ||
|
||||
CONFIG.HERO_RECOMMEND_POST_TAG === ''
|
||||
!siteConfig('HEO_HERO_RECOMMEND_POST_TAG', null, CONFIG) ||
|
||||
siteConfig('HEO_HERO_RECOMMEND_POST_TAG', null, CONFIG) === ''
|
||||
) {
|
||||
return latestPosts
|
||||
}
|
||||
@@ -273,7 +273,7 @@ function getTopPosts({ latestPosts, allNavPages }) {
|
||||
let sortPosts = []
|
||||
|
||||
// 排序方式
|
||||
if (JSON.parse(CONFIG.HERO_RECOMMEND_POST_SORT_BY_UPDATE_TIME)) {
|
||||
if (JSON.parse(siteConfig('HEO_HERO_RECOMMEND_POST_SORT_BY_UPDATE_TIME', null, CONFIG))) {
|
||||
sortPosts = Object.create(allNavPages).sort((a, b) => {
|
||||
const dateA = new Date(a?.lastEditedDate)
|
||||
const dateB = new Date(b?.lastEditedDate)
|
||||
@@ -289,7 +289,7 @@ function getTopPosts({ latestPosts, allNavPages }) {
|
||||
break
|
||||
}
|
||||
// 查找标签
|
||||
if (post?.tags?.indexOf(CONFIG.HERO_RECOMMEND_POST_TAG) >= 0) {
|
||||
if (post?.tags?.indexOf(siteConfig('HEO_HERO_RECOMMEND_POST_TAG', null, CONFIG)) >= 0) {
|
||||
topPosts.push(post)
|
||||
}
|
||||
}
|
||||
@@ -330,7 +330,7 @@ function TodayCard({ cRef, siteInfo }) {
|
||||
* @param {*} e
|
||||
*/
|
||||
function handleCardClick(e) {
|
||||
router.push(CONFIG.HERO_TITLE_LINK)
|
||||
router.push(siteConfig('HEO_HERO_TITLE_LINK', null, CONFIG))
|
||||
}
|
||||
|
||||
return (
|
||||
@@ -354,8 +354,8 @@ function TodayCard({ cRef, siteInfo }) {
|
||||
className="z-10 flex justify-between w-full relative text-white p-10 items-end"
|
||||
>
|
||||
<div className="flex flex-col">
|
||||
<div className="text-xs font-light">{CONFIG.HERO_TITLE_4}</div>
|
||||
<div className="text-3xl font-bold">{CONFIG.HERO_TITLE_5}</div>
|
||||
<div className="text-xs font-light">{siteConfig('HEO_HERO_TITLE_4', null, CONFIG)}</div>
|
||||
<div className="text-3xl font-bold">{siteConfig('HEO_HERO_TITLE_5', null, CONFIG)}</div>
|
||||
</div>
|
||||
<div
|
||||
onClick={handleClickMore}
|
||||
|
||||
@@ -46,7 +46,7 @@ export function InfoCard(props) {
|
||||
<Link href='/about'><GlobeAlt className={'w-6 h-6'} /></Link>
|
||||
</div>
|
||||
<div className='bg-indigo-400 p-2 rounded-full w-10 items-center flex justify-center transition-colors duration-200 dark:bg-yellow-500 dark:hover:bg-black hover:bg-white'>
|
||||
<Link href={CONFIG.INFO_CARD_URL}><i className='fab fa-github text-xl' />
|
||||
<Link href={siteConfig('HEO_INFO_CARD_URL', null, CONFIG)}><i className='fab fa-github text-xl' />
|
||||
</Link>
|
||||
</div>
|
||||
</div>
|
||||
@@ -60,7 +60,7 @@ export function InfoCard(props) {
|
||||
* 欢迎语
|
||||
*/
|
||||
function GreetingsWords() {
|
||||
const greetings = CONFIG.INFOCARD_GREETINGS
|
||||
const greetings = siteConfig('HEO_INFOCARD_GREETINGS', null, CONFIG)
|
||||
const [greeting, setGreeting] = useState(greetings[0])
|
||||
// 每次点击,随机获取greetings中的一个
|
||||
const handleChangeGreeting = () => {
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import CONFIG from '../config'
|
||||
import { siteConfig } from '@/lib/config'
|
||||
|
||||
/**
|
||||
* 跳转到评论区
|
||||
@@ -6,7 +7,7 @@ import CONFIG from '../config'
|
||||
* @constructor
|
||||
*/
|
||||
const JumpToCommentButton = () => {
|
||||
if (!CONFIG.WIDGET_TO_COMMENT) {
|
||||
if (!siteConfig('HEO_WIDGET_TO_COMMENT', null, CONFIG)) {
|
||||
return <></>
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { useGlobal } from '@/lib/global'
|
||||
import CONFIG from '../config'
|
||||
import { siteConfig } from '@/lib/config'
|
||||
|
||||
/**
|
||||
* 跳转到网页顶部
|
||||
@@ -12,7 +13,7 @@ import CONFIG from '../config'
|
||||
const JumpToTopButton = ({ showPercent = true, percent }) => {
|
||||
const { locale } = useGlobal()
|
||||
|
||||
if (!CONFIG.WIDGET_TO_TOP) {
|
||||
if (!siteConfig('HEO_WIDGET_TO_TOP', null, CONFIG)) {
|
||||
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' })} >
|
||||
|
||||
@@ -10,9 +10,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.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 }
|
||||
{ name: locale.COMMON.ARTICLE, to: '/archive', slot: archiveSlot, show: siteConfig('HEO_MENU_ARCHIVE', null, CONFIG) },
|
||||
{ name: locale.COMMON.CATEGORY, to: '/category', slot: categorySlot, show: siteConfig('HEO_MENU_CATEGORY', null, CONFIG) },
|
||||
{ name: locale.COMMON.TAGS, to: '/tag', slot: tagSlot, show: siteConfig('HEO_MENU_TAG', null, CONFIG) }
|
||||
]
|
||||
|
||||
return (
|
||||
|
||||
@@ -8,10 +8,10 @@ export const MenuListSide = (props) => {
|
||||
const { locale } = useGlobal()
|
||||
|
||||
let links = [
|
||||
{ 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 }
|
||||
{ icon: 'fas fa-archive', name: locale.NAV.ARCHIVE, to: '/archive', show: siteConfig('HEO_MENU_ARCHIVE', null, CONFIG) },
|
||||
{ icon: 'fas fa-search', name: locale.NAV.SEARCH, to: '/search', show: siteConfig('HEO_MENU_SEARCH', null, CONFIG) },
|
||||
{ icon: 'fas fa-folder', name: locale.COMMON.CATEGORY, to: '/category', show: siteConfig('HEO_MENU_CATEGORY', null, CONFIG) },
|
||||
{ icon: 'fas fa-tag', name: locale.COMMON.TAGS, to: '/tag', show: siteConfig('HEO_MENU_TAG', null, CONFIG) }
|
||||
]
|
||||
|
||||
if (customNav) {
|
||||
|
||||
@@ -8,9 +8,9 @@ export const MenuListTop = (props) => {
|
||||
const { locale } = useGlobal()
|
||||
|
||||
let links = [
|
||||
{ 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 }
|
||||
{ id: 1, icon: 'fa-solid fa-house', name: locale.NAV.INDEX, to: '/', show: siteConfig('HEO_MENU_INDEX', null, CONFIG) },
|
||||
{ id: 2, icon: 'fas fa-search', name: locale.NAV.SEARCH, to: '/search', show: siteConfig('HEO_MENU_SEARCH', null, CONFIG) },
|
||||
{ id: 3, icon: 'fas fa-archive', name: locale.NAV.ARCHIVE, to: '/archive', show: siteConfig('HEO_MENU_ARCHIVE', null, CONFIG) }
|
||||
]
|
||||
|
||||
if (customNav) {
|
||||
|
||||
@@ -2,12 +2,13 @@
|
||||
import { ArrowRightCircle } from '@/components/HeroIcons'
|
||||
import CONFIG from '../config'
|
||||
import Swipe from './Swipe'
|
||||
import { siteConfig } from '@/lib/config'
|
||||
|
||||
/**
|
||||
* 通知横幅
|
||||
*/
|
||||
export function NoticeBar() {
|
||||
const notices = CONFIG.NOTICE_BAR
|
||||
const notices = siteConfig('HEO_NOTICE_BAR', null, CONFIG)
|
||||
|
||||
if (!notices || notices?.length === 0) {
|
||||
return <></>
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { useGlobal } from '@/lib/global'
|
||||
import CONFIG from '../config'
|
||||
import { siteConfig } from '@/lib/config'
|
||||
|
||||
/**
|
||||
* 点击召唤目录抽屉
|
||||
@@ -10,7 +11,7 @@ import CONFIG from '../config'
|
||||
*/
|
||||
const TocDrawerButton = (props) => {
|
||||
const { locale } = useGlobal()
|
||||
if (!CONFIG.WIDGET_TOC) {
|
||||
if (!siteConfig('HEO_WIDGET_TOC', null, CONFIG)) {
|
||||
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} >
|
||||
|
||||
@@ -2,13 +2,14 @@
|
||||
import FlipCard from '@/components/FlipCard'
|
||||
import Link from 'next/link'
|
||||
import CONFIG from '../config'
|
||||
import { siteConfig } from '@/lib/config'
|
||||
|
||||
/**
|
||||
* 交流频道
|
||||
* @returns
|
||||
*/
|
||||
export default function TouchMeCard() {
|
||||
if (!JSON.parse(CONFIG.SOCIAL_CARD)) {
|
||||
if (!JSON.parse(siteConfig('HEO_SOCIAL_CARD', null, CONFIG))) {
|
||||
return <></>
|
||||
}
|
||||
return (
|
||||
@@ -18,13 +19,13 @@ export default function TouchMeCard() {
|
||||
className='cursor-pointer lg:p-6 p-4 border rounded-xl bg-[#4f65f0] dark:bg-yellow-600 dark:border-gray-600'
|
||||
frontContent={
|
||||
<div className='h-full'>
|
||||
<h2 className='font-[1000] text-3xl'>{CONFIG.SOCIAL_CARD_TITLE_1}</h2>
|
||||
<h3 className='pt-2'>{CONFIG.SOCIAL_CARD_TITLE_2}</h3>
|
||||
<h2 className='font-[1000] text-3xl'>{siteConfig('HEO_SOCIAL_CARD_TITLE_1', null, CONFIG)}</h2>
|
||||
<h3 className='pt-2'>{siteConfig('HEO_SOCIAL_CARD_TITLE_2', null, CONFIG)}</h3>
|
||||
<div className='absolute left-0 top-0 w-full h-full' style={{ background: 'url(https://bu.dusays.com/2023/05/16/64633c4cd36a9.png) center center no-repeat' }}></div>
|
||||
</div>}
|
||||
backContent={<Link href={CONFIG.SOCIAL_CARD_URL}>
|
||||
backContent={<Link href={siteConfig('HEO_SOCIAL_CARD_URL', null, CONFIG)}>
|
||||
<div className='font-[1000] text-xl h-full'>
|
||||
{CONFIG.SOCIAL_CARD_TITLE_3}
|
||||
{siteConfig('HEO_SOCIAL_CARD_TITLE_3', null, CONFIG)}
|
||||
</div>
|
||||
</Link>}
|
||||
/>
|
||||
|
||||
@@ -1,34 +1,34 @@
|
||||
const CONFIG = {
|
||||
HOME_BANNER_ENABLE: true,
|
||||
HEO_HOME_BANNER_ENABLE: true,
|
||||
|
||||
SITE_CREATE_TIME: '2021-09-21', // 建站日期,用于计算网站运行的第几天
|
||||
HEO_SITE_CREATE_TIME: '2021-09-21', // 建站日期,用于计算网站运行的第几天
|
||||
|
||||
// 首页顶部通知条滚动内容,如不需要可以留空 []
|
||||
NOTICE_BAR: [
|
||||
HEO_NOTICE_BAR: [
|
||||
{ title: '欢迎来到我的博客', url: 'https://blog.tangly1024.com' },
|
||||
{ title: '访问文档中心获取更多帮助', url: 'https://docs.tangly1024.com' }
|
||||
],
|
||||
|
||||
// 英雄区(首页顶部大卡)
|
||||
HERO_TITLE_1: '分享编程',
|
||||
HERO_TITLE_2: '与思维认知',
|
||||
HERO_TITLE_3: 'TANGLY1024.COM',
|
||||
HERO_TITLE_4: '新版上线',
|
||||
HERO_TITLE_5: 'NotionNext4.0 轻松定制主题',
|
||||
HERO_TITLE_LINK: 'https://tangly1024.com',
|
||||
HEO_HERO_TITLE_1: '分享编程',
|
||||
HEO_HERO_TITLE_2: '与思维认知',
|
||||
HEO_HERO_TITLE_3: 'TANGLY1024.COM',
|
||||
HEO_HERO_TITLE_4: '新版上线',
|
||||
HEO_HERO_TITLE_5: 'NotionNext4.0 轻松定制主题',
|
||||
HEO_HERO_TITLE_LINK: 'https://tangly1024.com',
|
||||
|
||||
// 英雄区显示三个置顶分类
|
||||
HERO_CATEGORY_1: { title: '必看精选', url: '/tag/必看精选' },
|
||||
HERO_CATEGORY_2: { title: '热门文章', url: '/tag/热门文章' },
|
||||
HERO_CATEGORY_3: { title: '实用教程', url: '/tag/实用教程' },
|
||||
HEO_HERO_CATEGORY_1: { title: '必看精选', url: '/tag/必看精选' },
|
||||
HEO_HERO_CATEGORY_2: { title: '热门文章', url: '/tag/热门文章' },
|
||||
HEO_HERO_CATEGORY_3: { title: '实用教程', url: '/tag/实用教程' },
|
||||
|
||||
// 英雄区右侧推荐文章标签, 例如 [推荐] , 最多六篇文章; 若留空白'',则推荐最近更新文章
|
||||
HERO_RECOMMEND_POST_TAG: '推荐',
|
||||
HERO_RECOMMEND_POST_SORT_BY_UPDATE_TIME: false, // 推荐文章排序,为`true`时将强制按最后修改时间倒序
|
||||
HEO_HERO_RECOMMEND_POST_TAG: '推荐',
|
||||
HEO_HERO_RECOMMEND_POST_SORT_BY_UPDATE_TIME: false, // 推荐文章排序,为`true`时将强制按最后修改时间倒序
|
||||
// HERO_RECOMMEND_COVER: 'https://cdn.pixabay.com/photo/2015/10/30/20/13/sunrise-1014712_1280.jpg', // 英雄区右侧图片
|
||||
|
||||
// 右侧个人资料卡牌欢迎语,点击可自动切换
|
||||
INFOCARD_GREETINGS: [
|
||||
HEO_INFOCARD_GREETINGS: [
|
||||
'你好!我是',
|
||||
'🔍 分享与热心帮助',
|
||||
'🤝 专修交互与设计',
|
||||
@@ -37,10 +37,10 @@ const CONFIG = {
|
||||
'🤖️ 数码科技爱好者',
|
||||
'🧱 团队小组发动机'
|
||||
],
|
||||
INFO_CARD_URL: 'https://github.com/tangly1024/NotionNext', // 个人资料底部按钮链接
|
||||
HEO_INFO_CARD_URL: 'https://github.com/tangly1024/NotionNext', // 个人资料底部按钮链接
|
||||
|
||||
// 用户技能图标
|
||||
GROUP_ICONS: [
|
||||
HEO_GROUP_ICONS: [
|
||||
{
|
||||
title_1: 'AfterEffect',
|
||||
img_1: '/images/heo/20239df3f66615b532ce571eac6d14ff21cf072602.webp',
|
||||
@@ -99,37 +99,37 @@ const CONFIG = {
|
||||
}
|
||||
],
|
||||
|
||||
SOCIAL_CARD: true, // 是否显示右侧,点击加入社群按钮
|
||||
SOCIAL_CARD_TITLE_1: '交流频道',
|
||||
SOCIAL_CARD_TITLE_2: '加入我们的社群讨论分享',
|
||||
SOCIAL_CARD_TITLE_3: '点击加入社群',
|
||||
SOCIAL_CARD_URL: 'https://docs.tangly1024.com/article/how-to-question',
|
||||
HEO_SOCIAL_CARD: true, // 是否显示右侧,点击加入社群按钮
|
||||
HEO_SOCIAL_CARD_TITLE_1: '交流频道',
|
||||
HEO_SOCIAL_CARD_TITLE_2: '加入我们的社群讨论分享',
|
||||
HEO_SOCIAL_CARD_TITLE_3: '点击加入社群',
|
||||
HEO_SOCIAL_CARD_URL: 'https://docs.tangly1024.com/article/how-to-question',
|
||||
|
||||
// ***** 以下配置无效,只是预留开发 ****
|
||||
// 菜单配置
|
||||
MENU_INDEX: true, // 显示首页
|
||||
MENU_CATEGORY: true, // 显示分类
|
||||
MENU_TAG: true, // 显示标签
|
||||
MENU_ARCHIVE: true, // 显示归档
|
||||
MENU_SEARCH: true, // 显示搜索
|
||||
HEO_MENU_INDEX: true, // 显示首页
|
||||
HEO_MENU_CATEGORY: true, // 显示分类
|
||||
HEO_MENU_TAG: true, // 显示标签
|
||||
HEO_MENU_ARCHIVE: true, // 显示归档
|
||||
HEO_MENU_SEARCH: true, // 显示搜索
|
||||
|
||||
POST_LIST_COVER: true, // 列表显示文章封面
|
||||
POST_LIST_COVER_HOVER_ENLARGE: false, // 列表鼠标悬停放大
|
||||
HEO_POST_LIST_COVER: true, // 列表显示文章封面
|
||||
HEO_POST_LIST_COVER_HOVER_ENLARGE: false, // 列表鼠标悬停放大
|
||||
|
||||
POST_LIST_COVER_DEFAULT: true, // 封面为空时用站点背景做默认封面
|
||||
POST_LIST_SUMMARY: true, // 文章摘要
|
||||
POST_LIST_PREVIEW: false, // 读取文章预览
|
||||
POST_LIST_IMG_CROSSOVER: true, // 博客列表图片左右交错
|
||||
HEO_POST_LIST_COVER_DEFAULT: true, // 封面为空时用站点背景做默认封面
|
||||
HEO_POST_LIST_SUMMARY: true, // 文章摘要
|
||||
HEO_POST_LIST_PREVIEW: false, // 读取文章预览
|
||||
HEO_POST_LIST_IMG_CROSSOVER: true, // 博客列表图片左右交错
|
||||
|
||||
ARTICLE_ADJACENT: true, // 显示上一篇下一篇文章推荐
|
||||
ARTICLE_COPYRIGHT: true, // 显示文章版权声明
|
||||
ARTICLE_RECOMMEND: true, // 文章关联推荐
|
||||
HEO_ARTICLE_ADJACENT: true, // 显示上一篇下一篇文章推荐
|
||||
HEO_ARTICLE_COPYRIGHT: true, // 显示文章版权声明
|
||||
HEO_ARTICLE_RECOMMEND: true, // 文章关联推荐
|
||||
|
||||
WIDGET_LATEST_POSTS: true, // 显示最新文章卡
|
||||
WIDGET_ANALYTICS: false, // 显示统计卡
|
||||
WIDGET_TO_TOP: true,
|
||||
WIDGET_TO_COMMENT: true, // 跳到评论区
|
||||
WIDGET_DARK_MODE: true, // 夜间模式
|
||||
WIDGET_TOC: true // 移动端悬浮目录
|
||||
HEO_WIDGET_LATEST_POSTS: true, // 显示最新文章卡
|
||||
HEO_WIDGET_ANALYTICS: false, // 显示统计卡
|
||||
HEO_WIDGET_TO_TOP: true,
|
||||
HEO_WIDGET_TO_COMMENT: true, // 跳到评论区
|
||||
HEO_WIDGET_DARK_MODE: true, // 夜间模式
|
||||
HEO_WIDGET_TOC: true // 移动端悬浮目录
|
||||
}
|
||||
export default CONFIG
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import Link from 'next/link'
|
||||
import CONFIG from '../config'
|
||||
import { siteConfig } from '@/lib/config'
|
||||
|
||||
/**
|
||||
* 上一篇,下一篇文章
|
||||
@@ -7,7 +8,7 @@ import CONFIG from '../config'
|
||||
* @returns
|
||||
*/
|
||||
export default function ArticleAdjacent ({ prev, next }) {
|
||||
if (!prev || !next || !CONFIG.ARTICLE_ADJACENT) {
|
||||
if (!prev || !next || !siteConfig('HEXO_ARTICLE_ADJACENT', null, CONFIG)) {
|
||||
return <></>
|
||||
}
|
||||
return (
|
||||
|
||||
@@ -14,7 +14,7 @@ export default function ArticleCopyright () {
|
||||
|
||||
const { locale } = useGlobal()
|
||||
|
||||
if (!CONFIG.ARTICLE_COPYRIGHT) {
|
||||
if (!siteConfig('HEXO_ARTICLE_COPYRIGHT', null, CONFIG)) {
|
||||
return <></>
|
||||
}
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ export default function ArticleRecommend({ recommendPosts, siteInfo }) {
|
||||
const { locale } = useGlobal()
|
||||
|
||||
if (
|
||||
!CONFIG.ARTICLE_RECOMMEND ||
|
||||
!siteConfig('HEXO_ARTICLE_RECOMMEND', null, CONFIG) ||
|
||||
!recommendPosts ||
|
||||
recommendPosts.length === 0
|
||||
) {
|
||||
|
||||
@@ -6,16 +6,16 @@ import LazyImage from '@/components/LazyImage'
|
||||
// import Image from 'next/image'
|
||||
|
||||
const BlogPostCard = ({ index, post, showSummary, siteInfo }) => {
|
||||
const showPreview = CONFIG.POST_LIST_PREVIEW && post.blockMap
|
||||
if (post && !post.pageCoverThumbnail && CONFIG.POST_LIST_COVER_DEFAULT) {
|
||||
const showPreview = siteConfig('HEXO_POST_LIST_PREVIEW', null, CONFIG) && post.blockMap
|
||||
if (post && !post.pageCoverThumbnail && siteConfig('HEXO_POST_LIST_COVER_DEFAULT', null, CONFIG)) {
|
||||
post.pageCoverThumbnail = siteInfo?.pageCover
|
||||
}
|
||||
const showPageCover = CONFIG.POST_LIST_COVER && post?.pageCoverThumbnail && !showPreview
|
||||
const showPageCover = siteConfig('HEXO_POST_LIST_COVER', null, CONFIG) && post?.pageCoverThumbnail && !showPreview
|
||||
// const delay = (index % 2) * 200
|
||||
|
||||
return (
|
||||
|
||||
<div className={`${CONFIG.POST_LIST_COVER_HOVER_ENLARGE ? ' hover:scale-110 transition-all duration-150' : ''}`} >
|
||||
<div className={`${siteConfig('HEXO_POST_LIST_COVER_HOVER_ENLARGE', null, CONFIG) ? ' hover:scale-110 transition-all duration-150' : ''}`} >
|
||||
<div key={post.id}
|
||||
data-aos="fade-up"
|
||||
data-aos-easing="ease-in-out"
|
||||
@@ -23,7 +23,7 @@ const BlogPostCard = ({ index, post, showSummary, siteInfo }) => {
|
||||
data-aos-once="false"
|
||||
data-aos-anchor-placement="top-bottom"
|
||||
id='blog-post-card'
|
||||
className={`group 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' : ''}
|
||||
className={`group md:h-56 w-full flex justify-between md:flex-row flex-col-reverse ${siteConfig('HEXO_POST_LIST_IMG_CROSSOVER', null, CONFIG) && index % 2 === 1 ? 'md:flex-row-reverse' : ''}
|
||||
overflow-hidden border dark:border-black rounded-xl bg-white dark:bg-hexo-black-gray`}>
|
||||
|
||||
{/* 文字内容 */}
|
||||
|
||||
@@ -13,7 +13,7 @@ import { getListByPage } from '@/lib/utils'
|
||||
* @returns {JSX.Element}
|
||||
* @constructor
|
||||
*/
|
||||
const BlogPostListScroll = ({ posts = [], currentSearch, showSummary = CONFIG.POST_LIST_SUMMARY, siteInfo }) => {
|
||||
const BlogPostListScroll = ({ posts = [], currentSearch, showSummary = siteConfig('HEXO_POST_LIST_SUMMARY', null, CONFIG), siteInfo }) => {
|
||||
const postsPerPage = parseInt(siteConfig('POSTS_PER_PAGE'))
|
||||
const [page, updatePage] = useState(1)
|
||||
const postsToShow = getListByPage(posts, page, postsPerPage)
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
import { useGlobal } from '@/lib/global'
|
||||
import { saveDarkModeToCookies } from '@/themes/theme'
|
||||
import CONFIG from '../config'
|
||||
import { siteConfig } from '@/lib/config'
|
||||
|
||||
export default function FloatDarkModeButton () {
|
||||
const { isDarkMode, updateDarkMode } = useGlobal()
|
||||
|
||||
if (!CONFIG.WIDGET_DARK_MODE) {
|
||||
if (!siteConfig('HEXO_WIDGET_DARK_MODE', null, CONFIG)) {
|
||||
return <></>
|
||||
}
|
||||
|
||||
|
||||
@@ -65,17 +65,17 @@ const Hero = props => {
|
||||
</div>
|
||||
|
||||
{/* 首页导航大按钮 */}
|
||||
{CONFIG.HOME_NAV_BUTTONS && <NavButtonGroup {...props} />}
|
||||
{siteConfig('HEXO_HOME_NAV_BUTTONS', null, CONFIG) && <NavButtonGroup {...props} />}
|
||||
|
||||
{/* 滚动按钮 */}
|
||||
<div onClick={scrollToWrapper} className="z-10 cursor-pointer w-full text-center py-4 text-3xl absolute bottom-10 text-white">
|
||||
<div className="opacity-70 animate-bounce text-xs">{CONFIG.SHOW_START_READING && locale.COMMON.START_READING}</div>
|
||||
<div className="opacity-70 animate-bounce text-xs">{siteConfig('HEXO_SHOW_START_READING', null, CONFIG) && locale.COMMON.START_READING}</div>
|
||||
<i className='opacity-70 animate-bounce fas fa-angle-down' />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<LazyImage id='header-cover' src={siteInfo?.pageCover}
|
||||
className={`header-cover w-full h-screen object-cover object-center ${CONFIG.HOME_NAV_BACKGROUND_IMG_FIXED ? 'fixed' : ''}`} />
|
||||
className={`header-cover w-full h-screen object-cover object-center ${siteConfig('HEXO_HOME_NAV_BACKGROUND_IMG_FIXED', null, CONFIG) ? 'fixed' : ''}`} />
|
||||
|
||||
</header>
|
||||
)
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import CONFIG from '../config'
|
||||
import { siteConfig } from '@/lib/config'
|
||||
|
||||
/**
|
||||
* 跳转到评论区
|
||||
@@ -6,7 +7,7 @@ import CONFIG from '../config'
|
||||
* @constructor
|
||||
*/
|
||||
const JumpToCommentButton = () => {
|
||||
if (!CONFIG.WIDGET_TO_COMMENT) {
|
||||
if (!siteConfig('HEXO_WIDGET_TO_COMMENT', null, CONFIG)) {
|
||||
return <></>
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { useGlobal } from '@/lib/global'
|
||||
import CONFIG from '../config'
|
||||
import { siteConfig } from '@/lib/config'
|
||||
|
||||
/**
|
||||
* 跳转到网页顶部
|
||||
@@ -12,7 +13,7 @@ import CONFIG from '../config'
|
||||
const JumpToTopButton = ({ showPercent = true, percent }) => {
|
||||
const { locale } = useGlobal()
|
||||
|
||||
if (!CONFIG.WIDGET_TO_TOP) {
|
||||
if (!siteConfig('HEXO_WIDGET_TO_TOP', null, CONFIG)) {
|
||||
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' })} >
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import Link from 'next/link'
|
||||
import { useGlobal } from '@/lib/global'
|
||||
import CONFIG from '../config'
|
||||
import { siteConfig } from '@/lib/config'
|
||||
|
||||
const MenuGroupCard = (props) => {
|
||||
const { postCount, categoryOptions, tagOptions } = props
|
||||
@@ -10,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.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 }
|
||||
{ name: locale.COMMON.ARTICLE, to: '/archive', slot: archiveSlot, show: siteConfig('HEXO_MENU_ARCHIVE', null, CONFIG) },
|
||||
{ name: locale.COMMON.CATEGORY, to: '/category', slot: categorySlot, show: siteConfig('HEXO_MENU_CATEGORY', null, CONFIG) },
|
||||
{ name: locale.COMMON.TAGS, to: '/tag', slot: tagSlot, show: siteConfig('HEXO_MENU_TAG', null, CONFIG) }
|
||||
]
|
||||
|
||||
for (let i = 0; i < links.length; i++) {
|
||||
|
||||
@@ -8,10 +8,10 @@ export const MenuListSide = (props) => {
|
||||
const { locale } = useGlobal()
|
||||
|
||||
let links = [
|
||||
{ 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 }
|
||||
{ icon: 'fas fa-archive', name: locale.NAV.ARCHIVE, to: '/archive', show: siteConfig('HEXO_MENU_ARCHIVE', null, CONFIG) },
|
||||
{ icon: 'fas fa-search', name: locale.NAV.SEARCH, to: '/search', show: siteConfig('HEXO_MENU_SEARCH', null, CONFIG) },
|
||||
{ icon: 'fas fa-folder', name: locale.COMMON.CATEGORY, to: '/category', show: siteConfig('HEXO_MENU_CATEGORY', null, CONFIG) },
|
||||
{ icon: 'fas fa-tag', name: locale.COMMON.TAGS, to: '/tag', show: siteConfig('HEXO_MENU_TAG', null, CONFIG) }
|
||||
]
|
||||
|
||||
if (customNav) {
|
||||
|
||||
@@ -8,11 +8,11 @@ export const MenuListTop = (props) => {
|
||||
const { locale } = useGlobal()
|
||||
|
||||
let links = [
|
||||
{ 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 }
|
||||
{ id: 1, icon: 'fa-solid fa-house', name: locale.NAV.INDEX, to: '/', show: siteConfig('HEXO_MENU_INDEX', null, CONFIG) },
|
||||
{ id: 2, icon: 'fas fa-search', name: locale.NAV.SEARCH, to: '/search', show: siteConfig('HEXO_MENU_SEARCH', null, CONFIG) },
|
||||
{ id: 3, icon: 'fas fa-archive', name: locale.NAV.ARCHIVE, to: '/archive', show: siteConfig('HEXO_MENU_ARCHIVE', null, CONFIG) }
|
||||
// { icon: 'fas fa-folder', name: locale.COMMON.CATEGORY, to: '/category', show: siteConfig('MENU_CATEGORY', null, CONFIG) },
|
||||
// { icon: 'fas fa-tag', name: locale.COMMON.TAGS, to: '/tag', show: siteConfig('MENU_TAG', null, CONFIG) }
|
||||
]
|
||||
|
||||
if (customNav) {
|
||||
|
||||
@@ -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.WIDGET_ANALYTICS && <AnalyticsCard {...props} />}
|
||||
{siteConfig('HEXO_WIDGET_ANALYTICS', null, CONFIG) && <AnalyticsCard {...props} />}
|
||||
|
||||
{showCategory && (
|
||||
<Card>
|
||||
@@ -59,7 +59,7 @@ export default function SideRight(props) {
|
||||
<TagGroups tags={tags} currentTag={currentTag} />
|
||||
</Card>
|
||||
)}
|
||||
{CONFIG.WIDGET_LATEST_POSTS && latestPosts && latestPosts.length > 0 && <Card>
|
||||
{siteConfig('HEXO_WIDGET_LATEST_POSTS', null, CONFIG) && latestPosts && latestPosts.length > 0 && <Card>
|
||||
<LatestPostsGroup {...props} />
|
||||
</Card>}
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { useGlobal } from '@/lib/global'
|
||||
import CONFIG from '../config'
|
||||
import { siteConfig } from '@/lib/config'
|
||||
|
||||
/**
|
||||
* 点击召唤目录抽屉
|
||||
@@ -10,7 +11,7 @@ import CONFIG from '../config'
|
||||
*/
|
||||
const TocDrawerButton = (props) => {
|
||||
const { locale } = useGlobal()
|
||||
if (!CONFIG.WIDGET_TOC) {
|
||||
if (!siteConfig('HEXO_WIDGET_TOC', null, CONFIG)) {
|
||||
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} >
|
||||
|
||||
@@ -1,38 +1,38 @@
|
||||
const CONFIG = {
|
||||
HOME_BANNER_ENABLE: true,
|
||||
HEXO_HOME_BANNER_ENABLE: true,
|
||||
// 3.14.1以后的版本中,欢迎语在blog.config.js中配置,用英文逗号','隔开多个。
|
||||
HOME_BANNER_GREETINGS: ['Hi,我是一个程序员', 'Hi,我是一个打工人', 'Hi,我是一个干饭人', '欢迎来到我的博客🎉'], // 首页大图标语文字
|
||||
HEXO_HOME_BANNER_GREETINGS: ['Hi,我是一个程序员', 'Hi,我是一个打工人', 'Hi,我是一个干饭人', '欢迎来到我的博客🎉'], // 首页大图标语文字
|
||||
|
||||
HOME_NAV_BUTTONS: true, // 首页是否显示分类大图标按钮
|
||||
HEXO_HOME_NAV_BUTTONS: true, // 首页是否显示分类大图标按钮
|
||||
// 已知未修复bug, 在移动端开启true后会加载不出图片; 暂时建议设置为false。
|
||||
HOME_NAV_BACKGROUND_IMG_FIXED: false, // 首页背景图滚动时是否固定,true 则滚动时图片不懂动; false则随鼠标滚动 ;
|
||||
HEXO_HOME_NAV_BACKGROUND_IMG_FIXED: false, // 首页背景图滚动时是否固定,true 则滚动时图片不懂动; false则随鼠标滚动 ;
|
||||
// 是否显示开始阅读按钮
|
||||
SHOW_START_READING: true,
|
||||
HEXO_SHOW_START_READING: true,
|
||||
|
||||
// 菜单配置
|
||||
MENU_INDEX: true, // 显示首页
|
||||
MENU_CATEGORY: true, // 显示分类
|
||||
MENU_TAG: true, // 显示标签
|
||||
MENU_ARCHIVE: true, // 显示归档
|
||||
MENU_SEARCH: true, // 显示搜索
|
||||
HEXO_MENU_INDEX: true, // 显示首页
|
||||
HEXO_MENU_CATEGORY: true, // 显示分类
|
||||
HEXO_MENU_TAG: true, // 显示标签
|
||||
HEXO_MENU_ARCHIVE: true, // 显示归档
|
||||
HEXO_MENU_SEARCH: true, // 显示搜索
|
||||
|
||||
POST_LIST_COVER: true, // 列表显示文章封面
|
||||
POST_LIST_COVER_HOVER_ENLARGE: false, // 列表鼠标悬停放大
|
||||
HEXO_POST_LIST_COVER: true, // 列表显示文章封面
|
||||
HEXO_POST_LIST_COVER_HOVER_ENLARGE: false, // 列表鼠标悬停放大
|
||||
|
||||
POST_LIST_COVER_DEFAULT: true, // 封面为空时用站点背景做默认封面
|
||||
POST_LIST_SUMMARY: true, // 文章摘要
|
||||
POST_LIST_PREVIEW: false, // 读取文章预览
|
||||
POST_LIST_IMG_CROSSOVER: true, // 博客列表图片左右交错
|
||||
HEXO_POST_LIST_COVER_DEFAULT: true, // 封面为空时用站点背景做默认封面
|
||||
HEXO_POST_LIST_SUMMARY: true, // 文章摘要
|
||||
HEXO_POST_LIST_PREVIEW: false, // 读取文章预览
|
||||
HEXO_POST_LIST_IMG_CROSSOVER: true, // 博客列表图片左右交错
|
||||
|
||||
ARTICLE_ADJACENT: true, // 显示上一篇下一篇文章推荐
|
||||
ARTICLE_COPYRIGHT: true, // 显示文章版权声明
|
||||
ARTICLE_RECOMMEND: true, // 文章关联推荐
|
||||
HEXO_ARTICLE_ADJACENT: true, // 显示上一篇下一篇文章推荐
|
||||
HEXO_ARTICLE_COPYRIGHT: true, // 显示文章版权声明
|
||||
HEXO_ARTICLE_RECOMMEND: true, // 文章关联推荐
|
||||
|
||||
WIDGET_LATEST_POSTS: true, // 显示最新文章卡
|
||||
WIDGET_ANALYTICS: false, // 显示统计卡
|
||||
WIDGET_TO_TOP: true,
|
||||
WIDGET_TO_COMMENT: true, // 跳到评论区
|
||||
WIDGET_DARK_MODE: true, // 夜间模式
|
||||
WIDGET_TOC: true // 移动端悬浮目录
|
||||
HEXO_WIDGET_LATEST_POSTS: true, // 显示最新文章卡
|
||||
HEXO_WIDGET_ANALYTICS: false, // 显示统计卡
|
||||
HEXO_WIDGET_TO_TOP: true,
|
||||
HEXO_WIDGET_TO_COMMENT: true, // 跳到评论区
|
||||
HEXO_WIDGET_DARK_MODE: true, // 夜间模式
|
||||
HEXO_WIDGET_TOC: true // 移动端悬浮目录
|
||||
}
|
||||
export default CONFIG
|
||||
|
||||
@@ -68,7 +68,7 @@ const LayoutBase = props => {
|
||||
</Transition>
|
||||
|
||||
{/* 主区块 */}
|
||||
<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`}>
|
||||
<main id="wrapper" className={`${siteConfig('HEXO_HOME_BANNER_ENABLE', null, CONFIG) ? '' : '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={(JSON.parse(siteConfig('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 overflow-hidden`}>
|
||||
|
||||
@@ -111,7 +111,7 @@ const LayoutBase = props => {
|
||||
* @returns
|
||||
*/
|
||||
const LayoutIndex = (props) => {
|
||||
const headerSlot = CONFIG.HOME_BANNER_ENABLE && <Hero {...props} />
|
||||
const headerSlot = siteConfig('HEXO_HOME_BANNER_ENABLE', null, CONFIG) && <Hero {...props} />
|
||||
return <LayoutPostList {...props} headerSlot={headerSlot} className='pt-8' />
|
||||
}
|
||||
|
||||
|
||||
@@ -32,8 +32,8 @@ export default function Features() {
|
||||
|
||||
{/* Section header */}
|
||||
<div className="max-w-3xl mx-auto text-center pb-12 md:pb-16">
|
||||
<h1 className="h2 mb-4">{CONFIG.FEATURES_HEADER_1}</h1>
|
||||
<p className="text-xl text-gray-600 leading-relaxed" dangerouslySetInnerHTML={{ __html: CONFIG.FEATURES_HEADER_1_P }}></p>
|
||||
<h1 className="h2 mb-4">{siteConfig('LANDING_FEATURES_HEADER_1', null, CONFIG)}</h1>
|
||||
<p className="text-xl text-gray-600 leading-relaxed" dangerouslySetInnerHTML={{ __html: siteConfig('LANDING_FEATURES_HEADER_1_P', null, CONFIG) }}></p>
|
||||
</div>
|
||||
|
||||
{/* Section content */}
|
||||
@@ -42,8 +42,8 @@ export default function Features() {
|
||||
{/* Content */}
|
||||
<div className="max-w-xl md:max-w-none md:w-full mx-auto md:col-span-7 lg:col-span-6 md:mt-6" data-aos="fade-right">
|
||||
<div className="md:pr-4 lg:pr-12 xl:pr-16 mb-8">
|
||||
<h3 className="h3 mb-3">{CONFIG.FEATURES_HEADER_2}</h3>
|
||||
<p className="text-xl text-gray-600">{CONFIG.FEATURES_HEADER_2_P}</p>
|
||||
<h3 className="h3 mb-3">{siteConfig('LANDING_FEATURES_HEADER_2', null, CONFIG)}</h3>
|
||||
<p className="text-xl text-gray-600">{siteConfig('LANDING_FEATURES_HEADER_2_P', null, CONFIG)}</p>
|
||||
</div>
|
||||
{/* Tabs buttons */}
|
||||
<div className="mb-8 md:mb-0">
|
||||
@@ -53,8 +53,8 @@ export default function Features() {
|
||||
onClick={(e) => { e.preventDefault(); setTab(1) }}
|
||||
>
|
||||
<div>
|
||||
<div className="font-bold leading-snug tracking-tight mb-1">{CONFIG.FEATURES_CARD_1_TITLE}</div>
|
||||
<div className="text-gray-600">{CONFIG.FEATURES_CARD_1_P}</div>
|
||||
<div className="font-bold leading-snug tracking-tight mb-1">{siteConfig('LANDING_FEATURES_CARD_1_TITLE', null, CONFIG)}</div>
|
||||
<div className="text-gray-600">{siteConfig('LANDING_FEATURES_CARD_1_P', null, CONFIG)}</div>
|
||||
</div>
|
||||
<div className="flex justify-center items-center w-8 h-8 bg-white rounded-full shadow flex-shrink-0 ml-3">
|
||||
<svg className="w-3 h-3 fill-current" viewBox="0 0 12 12" xmlns="http://www.w3.org/2000/svg">
|
||||
@@ -68,8 +68,8 @@ export default function Features() {
|
||||
onClick={(e) => { e.preventDefault(); setTab(2) }}
|
||||
>
|
||||
<div>
|
||||
<div className="font-bold leading-snug tracking-tight mb-1">{CONFIG.FEATURES_CARD_2_TITLE}</div>
|
||||
<div className="text-gray-600">{CONFIG.FEATURES_CARD_2_P}</div>
|
||||
<div className="font-bold leading-snug tracking-tight mb-1">{siteConfig('LANDING_FEATURES_CARD_2_TITLE', null, CONFIG)}</div>
|
||||
<div className="text-gray-600">{siteConfig('LANDING_FEATURES_CARD_2_P', null, CONFIG)}</div>
|
||||
</div>
|
||||
<div className="flex justify-center items-center w-8 h-8 bg-white rounded-full shadow flex-shrink-0 ml-3">
|
||||
<svg className="w-3 h-3 fill-current" viewBox="0 0 12 12" xmlns="http://www.w3.org/2000/svg">
|
||||
@@ -83,8 +83,8 @@ export default function Features() {
|
||||
onClick={(e) => { e.preventDefault(); setTab(3) }}
|
||||
>
|
||||
<div>
|
||||
<div className="font-bold leading-snug tracking-tight mb-1">{CONFIG.FEATURES_CARD_3_TITLE}</div>
|
||||
<div className="text-gray-600">{CONFIG.FEATURES_CARD_3_P}</div>
|
||||
<div className="font-bold leading-snug tracking-tight mb-1">{siteConfig('LANDING_FEATURES_CARD_3_TITLE', null, CONFIG)}</div>
|
||||
<div className="text-gray-600">{siteConfig('LANDING_FEATURES_CARD_3_P', null, CONFIG)}</div>
|
||||
</div>
|
||||
<div className="flex justify-center items-center w-8 h-8 bg-white rounded-full shadow flex-shrink-0 ml-3">
|
||||
<svg className="w-3 h-3 fill-current" viewBox="0 0 12 12" xmlns="http://www.w3.org/2000/svg">
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import CONFIG from '../config'
|
||||
import { siteConfig } from '@/lib/config'
|
||||
|
||||
export default function FeaturesBlocks() {
|
||||
return (
|
||||
@@ -13,8 +14,8 @@ export default function FeaturesBlocks() {
|
||||
|
||||
{/* Section header */}
|
||||
<div className="max-w-3xl mx-auto text-center pb-12 md:pb-20">
|
||||
<h2 className="h2 mb-4">{CONFIG.FEATURES_BLOCK_HEADER}</h2>
|
||||
<p className="text-xl text-gray-600" dangerouslySetInnerHTML={{ __html: CONFIG.FEATURES_BLOCK_P }}></p>
|
||||
<h2 className="h2 mb-4">{siteConfig('LANDING_FEATURES_BLOCK_HEADER', null, CONFIG)}</h2>
|
||||
<p className="text-xl text-gray-600" dangerouslySetInnerHTML={{ __html: siteConfig('LANDING_FEATURES_BLOCK_P', null, CONFIG) }}></p>
|
||||
</div>
|
||||
|
||||
{/* Items */}
|
||||
@@ -33,8 +34,8 @@ export default function FeaturesBlocks() {
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
||||
<h4 className="text-xl font-bold leading-snug tracking-tight mb-1">{CONFIG.FEATURES_BLOCK_1_TITLE}</h4>
|
||||
<p className="text-gray-600 text-center">{CONFIG.FEATURES_BLOCK_1_P}</p>
|
||||
<h4 className="text-xl font-bold leading-snug tracking-tight mb-1">{siteConfig('LANDING_FEATURES_BLOCK_1_TITLE', null, CONFIG)}</h4>
|
||||
<p className="text-gray-600 text-center">{siteConfig('LANDING_FEATURES_BLOCK_1_P', null, CONFIG)}</p>
|
||||
</div>
|
||||
|
||||
{/* 2nd item */}
|
||||
@@ -49,8 +50,8 @@ export default function FeaturesBlocks() {
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
||||
<h4 className="text-xl font-bold leading-snug tracking-tight mb-1">{CONFIG.FEATURES_BLOCK_2_TITLE}</h4>
|
||||
<p className="text-gray-600 text-center">{CONFIG.FEATURES_BLOCK_2_P}</p>
|
||||
<h4 className="text-xl font-bold leading-snug tracking-tight mb-1">{siteConfig('LANDING_FEATURES_BLOCK_2_TITLE', null, CONFIG)}</h4>
|
||||
<p className="text-gray-600 text-center">{siteConfig('LANDING_FEATURES_BLOCK_2_P', null, CONFIG)}</p>
|
||||
</div>
|
||||
|
||||
{/* 3rd item */}
|
||||
@@ -66,8 +67,8 @@ export default function FeaturesBlocks() {
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
||||
<h4 className="text-xl font-bold leading-snug tracking-tight mb-1">{CONFIG.FEATURES_BLOCK_3_TITLE}</h4>
|
||||
<p className="text-gray-600 text-center">{CONFIG.FEATURES_BLOCK_3_P}</p>
|
||||
<h4 className="text-xl font-bold leading-snug tracking-tight mb-1">{siteConfig('LANDING_FEATURES_BLOCK_3_TITLE', null, CONFIG)}</h4>
|
||||
<p className="text-gray-600 text-center">{siteConfig('LANDING_FEATURES_BLOCK_3_P', null, CONFIG)}</p>
|
||||
</div>
|
||||
|
||||
{/* 4th item */}
|
||||
@@ -83,8 +84,8 @@ export default function FeaturesBlocks() {
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
||||
<h4 className="text-xl font-bold leading-snug tracking-tight mb-1">{CONFIG.FEATURES_BLOCK_4_TITLE}</h4>
|
||||
<p className="text-gray-600 text-center">{CONFIG.FEATURES_BLOCK_4_P}</p>
|
||||
<h4 className="text-xl font-bold leading-snug tracking-tight mb-1">{siteConfig('LANDING_FEATURES_BLOCK_4_TITLE', null, CONFIG)}</h4>
|
||||
<p className="text-gray-600 text-center">{siteConfig('LANDING_FEATURES_BLOCK_4_P', null, CONFIG)}</p>
|
||||
</div>
|
||||
|
||||
{/* 5th item */}
|
||||
@@ -99,8 +100,8 @@ export default function FeaturesBlocks() {
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
||||
<h4 className="text-xl font-bold leading-snug tracking-tight mb-1">{CONFIG.FEATURES_BLOCK_5_TITLE}</h4>
|
||||
<p className="text-gray-600 text-center">{CONFIG.FEATURES_BLOCK_5_P}</p>
|
||||
<h4 className="text-xl font-bold leading-snug tracking-tight mb-1">{siteConfig('LANDING_FEATURES_BLOCK_5_TITLE', null, CONFIG)}</h4>
|
||||
<p className="text-gray-600 text-center">{siteConfig('LANDING_FEATURES_BLOCK_5_P', null, CONFIG)}</p>
|
||||
</div>
|
||||
|
||||
{/* 6th item */}
|
||||
@@ -114,8 +115,8 @@ export default function FeaturesBlocks() {
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
||||
<h4 className="text-xl font-bold leading-snug tracking-tight mb-1">{CONFIG.FEATURES_BLOCK_6_TITLE}</h4>
|
||||
<p className="text-gray-600 text-center">{CONFIG.FEATURES_BLOCK_6_P}</p>
|
||||
<h4 className="text-xl font-bold leading-snug tracking-tight mb-1">{siteConfig('LANDING_FEATURES_BLOCK_6_TITLE', null, CONFIG)}</h4>
|
||||
<p className="text-gray-600 text-center">{siteConfig('LANDING_FEATURES_BLOCK_6_P', null, CONFIG)}</p>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
@@ -3,6 +3,7 @@ import Link from 'next/link'
|
||||
import { useEffect, useRef, useState } from 'react'
|
||||
import CONFIG from '../config'
|
||||
import Logo from './Logo'
|
||||
import { siteConfig } from '@/lib/config'
|
||||
|
||||
/**
|
||||
* 页脚
|
||||
@@ -115,7 +116,7 @@ export default function Footer() {
|
||||
</div>
|
||||
|
||||
{/* 开启邮件收集 */}
|
||||
{JSON.parse(CONFIG.NEWSLETTER) && <>
|
||||
{JSON.parse(siteConfig('LANDING_NEWSLETTER', null, CONFIG)) && <>
|
||||
{/* 5th block */}
|
||||
<div className="sm:col-span-6 md:col-span-3 lg:col-span-3">
|
||||
<h6 className="text-gray-800 font-medium mb-2">Subscribe</h6>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
'use client'
|
||||
|
||||
import { useState, useEffect } from 'react'
|
||||
|
||||
import { siteConfig } from '@/lib/config'
|
||||
import Link from 'next/link'
|
||||
import Logo from './Logo'
|
||||
import MobileMenu from './MobileMenu'
|
||||
@@ -36,13 +36,13 @@ export default function Header() {
|
||||
{/* Desktop sign in links */}
|
||||
<ul className="flex grow justify-end flex-wrap items-center">
|
||||
<li>
|
||||
<Link href={CONFIG.HEDEAR_BUTTON_1_URL} target='_blank' className="font-medium hover:font-bold text-gray-600 hover:text-gray-900 px-5 py-3 flex items-center transition duration-150 ease-in-out">
|
||||
<div>{CONFIG.HEADER_BUTTON_1_TITLE}</div>
|
||||
<Link href={siteConfig('LANDING_HEDEAR_BUTTON_1_URL', null, CONFIG)} target='_blank' className="font-medium hover:font-bold text-gray-600 hover:text-gray-900 px-5 py-3 flex items-center transition duration-150 ease-in-out">
|
||||
<div>{siteConfig('LANDING_HEADER_BUTTON_1_TITLE', null, CONFIG)}</div>
|
||||
</Link>
|
||||
</li>
|
||||
<li>
|
||||
<Link href={CONFIG.HEDEAR_BUTTON_2_URL} target='_blank' className="btn-sm text-gray-200 bg-gray-900 hover:bg-gray-800 ml-3">
|
||||
<span>{CONFIG.HEADER_BUTTON_2_TITLE}</span>
|
||||
<Link href={siteConfig('LANDING_HEDEAR_BUTTON_2_URL', null, CONFIG)} target='_blank' className="btn-sm text-gray-200 bg-gray-900 hover:bg-gray-800 ml-3">
|
||||
<span>{siteConfig('LANDING_HEADER_BUTTON_2_TITLE', null, CONFIG)}</span>
|
||||
<svg className="w-3 h-3 fill-current text-gray-400 shrink-0 ml-2 -mr-1" viewBox="0 0 12 12" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M11.707 5.293L7 .586 5.586 2l3 3H0v2h8.586l-3 3L7 11.414l4.707-4.707a1 1 0 000-1.414z" fillRule="nonzero" />
|
||||
</svg>
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import CONFIG from '../config'
|
||||
import ModalVideo from './ModalVideo'
|
||||
import { siteConfig } from '@/lib/config'
|
||||
|
||||
export default function Hero() {
|
||||
return (
|
||||
@@ -30,21 +31,21 @@ export default function Hero() {
|
||||
{/* Section header */}
|
||||
<div className="text-center pb-12 md:pb-16">
|
||||
<h1 className="text-5xl md:text-6xl font-extrabold leading-tighter tracking-tighter mb-4" data-aos="zoom-y-out">
|
||||
<span className="bg-clip-text text-transparent bg-gradient-to-r from-blue-500 to-teal-400">{CONFIG.HERO_TITLE_1}</span>
|
||||
<span className="bg-clip-text text-transparent bg-gradient-to-r from-blue-500 to-teal-400">{siteConfig('LANDING_HERO_TITLE_1', null, CONFIG)}</span>
|
||||
</h1>
|
||||
<div className="max-w-3xl mx-auto">
|
||||
<p className="text-xl text-gray-600 mb-8" data-aos="zoom-y-out" data-aos-delay="150">{CONFIG.HERO_P_1}</p>
|
||||
<p className="text-xl text-gray-600 mb-8" data-aos="zoom-y-out" data-aos-delay="150">{siteConfig('LANDING_HERO_P_1', null, CONFIG)}</p>
|
||||
<div className="max-w-xs mx-auto sm:max-w-none sm:flex sm:justify-center" data-aos="zoom-y-out" data-aos-delay="300">
|
||||
<div>
|
||||
<a target='_blank' className="btn text-white bg-blue-600 hover:bg-blue-700 w-full mb-4 sm:w-auto sm:mb-0"
|
||||
href={CONFIG.HERO_BUTTON_1_LINK} rel="noreferrer">
|
||||
{CONFIG.HERO_BUTTON_1_TEXT}
|
||||
href={siteConfig('LANDING_HERO_BUTTON_1_LINK', null, CONFIG)} rel="noreferrer">
|
||||
{siteConfig('LANDING_HERO_BUTTON_1_TEXT', null, CONFIG)}
|
||||
</a>
|
||||
</div>
|
||||
<div>
|
||||
<a target='_blank' className="btn text-white bg-gray-900 hover:bg-gray-800 w-full sm:w-auto sm:ml-4"
|
||||
href={CONFIG.HERO_BUTTON_2_LINK} rel="noreferrer">
|
||||
{CONFIG.HERO_BUTTON_2_TEXT}
|
||||
href={siteConfig('LANDING_HERO_BUTTON_2_LINK', null, CONFIG)} rel="noreferrer">
|
||||
{siteConfig('LANDING_HERO_BUTTON_2_TEXT', null, CONFIG)}
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
@@ -53,11 +54,11 @@ export default function Hero() {
|
||||
|
||||
{/* Hero image */}
|
||||
<ModalVideo
|
||||
thumb={CONFIG.HERO_VIDEO_IMAGE}
|
||||
thumb={siteConfig('LANDING_HERO_VIDEO_IMAGE', null, CONFIG)}
|
||||
thumbWidth={768}
|
||||
thumbHeight={432}
|
||||
thumbAlt={CONFIG.HERO_HEADER_1}
|
||||
video={CONFIG.HERO_VIDEO_URL}
|
||||
thumbAlt={siteConfig('HERO_HEADER_1', null, CONFIG)}
|
||||
video={siteConfig('HERO_VIDEO_URL', null, CONFIG)}
|
||||
videoWidth={1920}
|
||||
videoHeight={1080} />
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@ import { useState, useRef, useEffect } from 'react'
|
||||
import { Transition } from '@headlessui/react'
|
||||
import Link from 'next/link'
|
||||
import CONFIG from '../config'
|
||||
import { siteConfig } from '@/lib/config'
|
||||
|
||||
export default function MobileMenu() {
|
||||
const [mobileNavOpen, setMobileNavOpen] = useState(false)
|
||||
@@ -66,13 +67,13 @@ export default function MobileMenu() {
|
||||
>
|
||||
<ul className="px-5 py-2">
|
||||
<li>
|
||||
<Link href={CONFIG.HEDEAR_BUTTON_1_URL} className="flex font-medium w-full text-gray-600 hover:text-gray-900 py-2 justify-center" onClick={() => setMobileNavOpen(false)}>
|
||||
<div>{CONFIG.HEADER_BUTTON_1_TITLE}</div>
|
||||
<Link href={siteConfig('LANDING_HEDEAR_BUTTON_1_URL', null, CONFIG)} className="flex font-medium w-full text-gray-600 hover:text-gray-900 py-2 justify-center" onClick={() => setMobileNavOpen(false)}>
|
||||
<div>{siteConfig('LANDING_HEADER_BUTTON_1_TITLE', null, CONFIG)}</div>
|
||||
</Link>
|
||||
</li>
|
||||
<li>
|
||||
<Link href={CONFIG.HEDEAR_BUTTON_2_URL} className="btn-sm text-gray-200 bg-gray-900 hover:bg-gray-800 w-full my-2" onClick={() => setMobileNavOpen(false)}>
|
||||
<span>{CONFIG.HEADER_BUTTON_2_TITLE}</span>
|
||||
<Link href={siteConfig('LANDING_HEDEAR_BUTTON_2_URL', null, CONFIG)} className="btn-sm text-gray-200 bg-gray-900 hover:bg-gray-800 w-full my-2" onClick={() => setMobileNavOpen(false)}>
|
||||
<span>{siteConfig('LANDING_HEADER_BUTTON_2_TITLE', null, CONFIG)}</span>
|
||||
<svg className="w-3 h-3 fill-current text-gray-400 shrink-0 ml-2 -mr-1" viewBox="0 0 12 12" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M11.707 5.293L7 .586 5.586 2l3 3H0v2h8.586l-3 3L7 11.414l4.707-4.707a1 1 0 000-1.414z" fill="#999" fillRule="nonzero" />
|
||||
</svg>
|
||||
|
||||
@@ -4,6 +4,7 @@ import { useState, useRef, Fragment } from 'react'
|
||||
import { Dialog, Transition } from '@headlessui/react'
|
||||
import CONFIG from '../config'
|
||||
import LazyImage from '@/components/LazyImage'
|
||||
import { siteConfig } from '@/lib/config'
|
||||
|
||||
export default function ModalVideo({
|
||||
thumb,
|
||||
@@ -59,7 +60,7 @@ export default function ModalVideo({
|
||||
<path d="M12 22c5.523 0 10-4.477 10-10S17.523 2 12 2 2 6.477 2 12s4.477 10 10 10zm0 2C5.373 24 0 18.627 0 12S5.373 0 12 0s12 5.373 12 12-5.373 12-12 12z" />
|
||||
<path d="M10 17l6-5-6-5z" />
|
||||
</svg>
|
||||
<span className="ml-3">{CONFIG.HERO_VIDEO_TIPS}</span>
|
||||
<span className="ml-3">{siteConfig('LANDING_HERO_VIDEO_TIPS', null, CONFIG)}</span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
@@ -100,7 +101,7 @@ export default function ModalVideo({
|
||||
<div>
|
||||
<iframe
|
||||
className="video-iframe aspect-video w-screen md:w-[800px] mx-auto"
|
||||
src={CONFIG.HERO_VIDEO_IFRAME}
|
||||
src={siteConfig('LANDING_HERO_VIDEO_IFRAME', null, CONFIG)}
|
||||
scrolling="no"
|
||||
border="0"
|
||||
frameBorder="no"
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { subscribeToNewsletter } from '@/lib/mailchimp'
|
||||
import { useEffect, useRef, useState } from 'react'
|
||||
import CONFIG from '../config'
|
||||
import { siteConfig } from '@/lib/config'
|
||||
|
||||
export default function Newsletter() {
|
||||
const formRef = useRef()
|
||||
@@ -26,7 +27,7 @@ export default function Newsletter() {
|
||||
}
|
||||
}, [subscribeToNewsletter])
|
||||
|
||||
if (!JSON.parse(CONFIG.NEWSLETTER)) {
|
||||
if (!JSON.parse(siteConfig('LANDING_NEWSLETTER', null, CONFIG))) {
|
||||
return <></>
|
||||
}
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
|
||||
import LazyImage from '@/components/LazyImage'
|
||||
import CONFIG from '../config'
|
||||
import { siteConfig } from '@/lib/config'
|
||||
|
||||
export default function Testimonials() {
|
||||
return (
|
||||
@@ -30,8 +31,8 @@ export default function Testimonials() {
|
||||
|
||||
{/* Section header */}
|
||||
<div className="max-w-3xl mx-auto text-center pb-12 md:pb-16">
|
||||
<h2 className="h2 mb-4">{CONFIG.TESTIMONIALS_HEADER}</h2>
|
||||
<p className="text-xl text-gray-600" data-aos="zoom-y-out">{CONFIG.TESTIMONIALS_P}</p>
|
||||
<h2 className="h2 mb-4">{siteConfig('LANDING_TESTIMONIALS_HEADER', null, CONFIG)}</h2>
|
||||
<p className="text-xl text-gray-600" data-aos="zoom-y-out">{siteConfig('LANDING_TESTIMONIALS_P', null, CONFIG)}</p>
|
||||
</div>
|
||||
|
||||
{/* Testimonials */}
|
||||
@@ -44,14 +45,14 @@ export default function Testimonials() {
|
||||
<svg className="absolute top-0 right-0 -mt-3 -mr-8 w-16 h-16 fill-current text-blue-500" viewBox="0 0 64 64" aria-hidden="true" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M37.89 58.338c-2.648-5.63-3.572-10.045-2.774-13.249.8-3.203 8.711-13.383 23.737-30.538l2.135.532c-6.552 10.033-10.532 17.87-11.939 23.515-.583 2.34.22 6.158 2.41 11.457l-13.57 8.283zm-26.963-6.56c-2.648-5.63-3.572-10.046-2.773-13.25.799-3.203 8.71-13.382 23.736-30.538l2.136.533c-6.552 10.032-10.532 17.87-11.94 23.515-.583 2.339.22 6.158 2.41 11.456l-13.57 8.283z" />
|
||||
</svg>
|
||||
<LazyImage className="relative rounded-full w-20 h-20 object-cover" src={CONFIG.TESTIMONIALS_AVATAR} alt="Testimonial 01" />
|
||||
<LazyImage className="relative rounded-full w-20 h-20 object-cover" src={siteConfig('LANDING_TESTIMONIALS_AVATAR', null, CONFIG)} alt="Testimonial 01" />
|
||||
</div>
|
||||
<blockquote className="text-xl font-medium mb-4">
|
||||
{CONFIG.TESTIMONIALS_WORD}
|
||||
{siteConfig('LANDING_TESTIMONIALS_WORD', null, CONFIG)}
|
||||
</blockquote>
|
||||
<cite className="block font-bold text-lg not-italic mb-1">{CONFIG.TESTIMONIALS_NICKNAME}</cite>
|
||||
<cite className="block font-bold text-lg not-italic mb-1">{siteConfig('LANDING_TESTIMONIALS_NICKNAME', null, CONFIG)}</cite>
|
||||
<div className="text-gray-600">
|
||||
<span>{CONFIG.TESTIMONIALS_ID}</span> <a className="text-blue-600 hover:underline" href={CONFIG.TESTIMONIALS_SOCIAL_URL}>{CONFIG.TESTIMONIALS_SOCIAL_NAME}</a>
|
||||
<span>{siteConfig('LANDING_TESTIMONIALS_ID', null, CONFIG)}</span> <a className="text-blue-600 hover:underline" href={siteConfig('LANDING_TESTIMONIALS_SOCIAL_URL', null, CONFIG)}>{siteConfig('LANDING_TESTIMONIALS_SOCIAL_NAME', null, CONFIG)}</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -1,65 +1,65 @@
|
||||
const CONFIG = {
|
||||
|
||||
HEADER_BUTTON_1_TITLE: 'Github开源',
|
||||
HEDEAR_BUTTON_1_URL: 'https://github.com/tangly1024/NotionNext',
|
||||
LANDING_HEADER_BUTTON_1_TITLE: 'Github开源',
|
||||
LANDING_HEDEAR_BUTTON_1_URL: 'https://github.com/tangly1024/NotionNext',
|
||||
|
||||
HEADER_BUTTON_2_TITLE: '作者博客',
|
||||
HEDEAR_BUTTON_2_URL: 'https://blog.tangly1024.com/',
|
||||
LANDING_HEADER_BUTTON_2_TITLE: '作者博客',
|
||||
LANDING_HEDEAR_BUTTON_2_URL: 'https://blog.tangly1024.com/',
|
||||
|
||||
// 首页大图英雄板块
|
||||
HERO_TITLE_1: 'NotionNext',
|
||||
HERO_P_1: '快速搭建独立站、轻松放大品牌价值!',
|
||||
HERO_BUTTON_1_TEXT: '开始体验',
|
||||
HERO_BUTTON_1_LINK: 'https://docs.tangly1024.com/article/vercel-deploy-notion-next',
|
||||
HERO_BUTTON_2_TEXT: '了解更多',
|
||||
HERO_BUTTON_2_LINK: 'https://docs.tangly1024.com/about',
|
||||
HERO_VIDEO_IMAGE: '/images/home.png',
|
||||
LANDING_HERO_TITLE_1: 'NotionNext',
|
||||
LANDING_HERO_P_1: '快速搭建独立站、轻松放大品牌价值!',
|
||||
LANDING_HERO_BUTTON_1_TEXT: '开始体验',
|
||||
LANDING_HERO_BUTTON_1_LINK: 'https://docs.tangly1024.com/article/vercel-deploy-notion-next',
|
||||
LANDING_HERO_BUTTON_2_TEXT: '了解更多',
|
||||
LANDING_HERO_BUTTON_2_LINK: 'https://docs.tangly1024.com/about',
|
||||
LANDING_HERO_VIDEO_IMAGE: '/images/home.png',
|
||||
// HERO_VIDEO_URL: '/videos/video.mp4',
|
||||
HERO_VIDEO_IFRAME: '//player.bilibili.com/player.html?aid=913088616&bvid=BV1fM4y1L7Qi&cid=1187218697&page=1&&high_quality=1',
|
||||
HERO_VIDEO_TIPS: 'Watch the full video (2 min)',
|
||||
LANDING_HERO_VIDEO_IFRAME: '//player.bilibili.com/player.html?aid=913088616&bvid=BV1fM4y1L7Qi&cid=1187218697&page=1&&high_quality=1',
|
||||
LANDING_HERO_VIDEO_TIPS: 'Watch the full video (2 min)',
|
||||
|
||||
// 特性介绍
|
||||
FEATURES_HEADER_1: '探索的过程',
|
||||
FEATURES_HEADER_1_P: "如何搭建自己的门户网站,塑造一个品牌展示中心?<br/>曾经,它是系统<strong class='font-bold text-red-500'>繁重</strong>的Wordpress、是操作<strong class='font-bold text-red-500'>复杂</strong>的Hexo、是<strong class='font-bold text-red-500'>昂贵</strong>且<strong class='font-bold text-red-500'>不稳定</strong>的技术团队;<br/>现在,只要一个Notion笔记就够了",
|
||||
FEATURES_HEADER_2: 'Notion+NextJs组合方案',
|
||||
FEATURES_HEADER_2_P: '在Notion笔记中管理文章数据,NextJs将其渲染成网页排版,通过Vercel等第三方平台将您的网站发布到全球。',
|
||||
FEATURES_CARD_1_TITLE: '简单快速的系统',
|
||||
FEATURES_CARD_1_P: '在Notion中写下一篇文章,内容立刻在您的网站首页中呈现给互联网',
|
||||
FEATURES_CARD_2_TITLE: '高效传播的媒介',
|
||||
FEATURES_CARD_2_P: '优秀的SEO、快速的响应速度,让您的产品和宣传触达到更多的受众',
|
||||
FEATURES_CARD_3_TITLE: '人性化的定制工具',
|
||||
FEATURES_CARD_3_P: '多款主题供您挑选,可以搭建各种不同风格和作用的网站,更多的主题正在陆续加入中。',
|
||||
LANDING_FEATURES_HEADER_1: '探索的过程',
|
||||
LANDING_FEATURES_HEADER_1_P: "如何搭建自己的门户网站,塑造一个品牌展示中心?<br/>曾经,它是系统<strong class='font-bold text-red-500'>繁重</strong>的Wordpress、是操作<strong class='font-bold text-red-500'>复杂</strong>的Hexo、是<strong class='font-bold text-red-500'>昂贵</strong>且<strong class='font-bold text-red-500'>不稳定</strong>的技术团队;<br/>现在,只要一个Notion笔记就够了",
|
||||
LANDING_FEATURES_HEADER_2: 'Notion+NextJs组合方案',
|
||||
LANDING_FEATURES_HEADER_2_P: '在Notion笔记中管理文章数据,NextJs将其渲染成网页排版,通过Vercel等第三方平台将您的网站发布到全球。',
|
||||
LANDING_FEATURES_CARD_1_TITLE: '简单快速的系统',
|
||||
LANDING_FEATURES_CARD_1_P: '在Notion中写下一篇文章,内容立刻在您的网站首页中呈现给互联网',
|
||||
LANDING_FEATURES_CARD_2_TITLE: '高效传播的媒介',
|
||||
LANDING_FEATURES_CARD_2_P: '优秀的SEO、快速的响应速度,让您的产品和宣传触达到更多的受众',
|
||||
LANDING_FEATURES_CARD_3_TITLE: '人性化的定制工具',
|
||||
LANDING_FEATURES_CARD_3_P: '多款主题供您挑选,可以搭建各种不同风格和作用的网站,更多的主题正在陆续加入中。',
|
||||
|
||||
// 特性介绍2
|
||||
FEATURES_BLOCK_HEADER: '解决方案',
|
||||
FEATURES_BLOCK_P: '人人自媒体的时代,一个网站将帮您链接更多的人,带给你无限的机会和客户。<br/>您还在等什么呢?',
|
||||
FEATURES_BLOCK_1_TITLE: '用网站来展示品牌',
|
||||
FEATURES_BLOCK_1_P: '比起线下渠道、一个公开域名和网站更有说服力',
|
||||
FEATURES_BLOCK_2_TITLE: 'SEO带来更多流量',
|
||||
FEATURES_BLOCK_2_P: '借助搜索引擎,精准定位您的受众',
|
||||
FEATURES_BLOCK_3_TITLE: '网站的性能很重要',
|
||||
FEATURES_BLOCK_3_P: '更快的响应,更好的用户体验',
|
||||
FEATURES_BLOCK_4_TITLE: '打造您的个人品牌',
|
||||
FEATURES_BLOCK_4_P: '继马斯克、乔布斯之后,您将是下一个传奇',
|
||||
FEATURES_BLOCK_5_TITLE: '写作表达是核心技能',
|
||||
FEATURES_BLOCK_5_P: '比起只阅读输入,更重要的是反思和输出',
|
||||
FEATURES_BLOCK_6_TITLE: '开始写博客吧',
|
||||
FEATURES_BLOCK_6_P: 'NotionNext,助您轻松开始写作',
|
||||
LANDING_FEATURES_BLOCK_HEADER: '解决方案',
|
||||
LANDING_FEATURES_BLOCK_P: '人人自媒体的时代,一个网站将帮您链接更多的人,带给你无限的机会和客户。<br/>您还在等什么呢?',
|
||||
LANDING_FEATURES_BLOCK_1_TITLE: '用网站来展示品牌',
|
||||
LANDING_FEATURES_BLOCK_1_P: '比起线下渠道、一个公开域名和网站更有说服力',
|
||||
LANDING_FEATURES_BLOCK_2_TITLE: 'SEO带来更多流量',
|
||||
LANDING_FEATURES_BLOCK_2_P: '借助搜索引擎,精准定位您的受众',
|
||||
LANDING_FEATURES_BLOCK_3_TITLE: '网站的性能很重要',
|
||||
LANDING_FEATURES_BLOCK_3_P: '更快的响应,更好的用户体验',
|
||||
LANDING_FEATURES_BLOCK_4_TITLE: '打造您的个人品牌',
|
||||
LANDING_FEATURES_BLOCK_4_P: '继马斯克、乔布斯之后,您将是下一个传奇',
|
||||
LANDING_FEATURES_BLOCK_5_TITLE: '写作表达是核心技能',
|
||||
LANDING_FEATURES_BLOCK_5_P: '比起只阅读输入,更重要的是反思和输出',
|
||||
LANDING_FEATURES_BLOCK_6_TITLE: '开始写博客吧',
|
||||
LANDING_FEATURES_BLOCK_6_P: 'NotionNext,助您轻松开始写作',
|
||||
|
||||
// 感言
|
||||
TESTIMONIALS_HEADER: '已搭建超5300个网站、总浏览量突破100,000,000+',
|
||||
TESTIMONIALS_P: '网站内容涵盖地产、教育、建筑、医学、机械、IT、电子、软件、自媒体、数位游民、短视频、电商、学生、摄影爱好者、旅行爱好者等等各行各业',
|
||||
LANDING_TESTIMONIALS_HEADER: '已搭建超5300个网站、总浏览量突破100,000,000+',
|
||||
LANDING_TESTIMONIALS_P: '网站内容涵盖地产、教育、建筑、医学、机械、IT、电子、软件、自媒体、数位游民、短视频、电商、学生、摄影爱好者、旅行爱好者等等各行各业',
|
||||
|
||||
TESTIMONIALS_AVATAR: 'https://www.notion.so/image/https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fsecure.notion-static.com%2F22de3fcb-d90d-4271-bc01-f815f476122b%2F4FE0A0C0-E487-4C74-BF8E-6F01A27461B8-14186-000008094BC289A6.jpg?table=collection&id=a320a2cc-6ebe-4a8d-95cc-ea94e63bced9&width=200',
|
||||
TESTIMONIALS_NICKNAME: 'Ryan_G',
|
||||
TESTIMONIALS_ID: 'Ryan`Log 站长',
|
||||
TESTIMONIALS_SOCIAL_NAME: '@Gaoran',
|
||||
TESTIMONIALS_SOCIAL_URL: 'https://blog.gaoran.xyz/',
|
||||
TESTIMONIALS_WORD: '“ 感谢大佬的方法。之前尝试过Super、Potion等国外的第三方平台,实现效果一般,个性化程度远不如这个方法,已经用起来了! “',
|
||||
LANDING_TESTIMONIALS_AVATAR: 'https://www.notion.so/image/https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fsecure.notion-static.com%2F22de3fcb-d90d-4271-bc01-f815f476122b%2F4FE0A0C0-E487-4C74-BF8E-6F01A27461B8-14186-000008094BC289A6.jpg?table=collection&id=a320a2cc-6ebe-4a8d-95cc-ea94e63bced9&width=200',
|
||||
LANDING_TESTIMONIALS_NICKNAME: 'Ryan_G',
|
||||
LANDING_TESTIMONIALS_ID: 'Ryan`Log 站长',
|
||||
LANDING_TESTIMONIALS_SOCIAL_NAME: '@Gaoran',
|
||||
LANDING_TESTIMONIALS_SOCIAL_URL: 'https://blog.gaoran.xyz/',
|
||||
LANDING_TESTIMONIALS_WORD: '“ 感谢大佬的方法。之前尝试过Super、Potion等国外的第三方平台,实现效果一般,个性化程度远不如这个方法,已经用起来了! “',
|
||||
|
||||
POST_REDIRECT_ENABLE: process.env.NEXT_PUBLIC_POST_REDIRECT_ENABLE || false, // 是否开启文章地址重定向 ; 用于迁移旧网站域名
|
||||
POST_REDIRECT_URL: process.env.NEXT_PUBLIC_POST_REDIRECT_URL || 'https://blog.tangly1024.com', // 重定向网站地址
|
||||
LANDING_POST_REDIRECT_ENABLE: process.env.NEXT_PUBLIC_POST_REDIRECT_ENABLE || false, // 是否开启文章地址重定向 ; 用于迁移旧网站域名
|
||||
LANDING_POST_REDIRECT_URL: process.env.NEXT_PUBLIC_POST_REDIRECT_URL || 'https://blog.tangly1024.com', // 重定向网站地址
|
||||
|
||||
NEWSLETTER: process.env.NEXT_PUBLIC_THEME_LANDING_NEWSLETTER || false // 是否开启邮件订阅 请先配置mailchimp功能 https://docs.tangly1024.com/article/notion-next-mailchimp
|
||||
LANDING_NEWSLETTER: process.env.NEXT_PUBLIC_THEME_LANDING_NEWSLETTER || false // 是否开启邮件订阅 请先配置mailchimp功能 https://docs.tangly1024.com/article/notion-next-mailchimp
|
||||
}
|
||||
export default CONFIG
|
||||
|
||||
@@ -81,8 +81,8 @@ const LayoutIndex = (props) => {
|
||||
const LayoutSlug = (props) => {
|
||||
// 如果 是 /article/[slug] 的文章路径则进行重定向到另一个域名
|
||||
const router = useRouter()
|
||||
if (JSON.parse(CONFIG.POST_REDIRECT_ENABLE) && isBrowser && router.route == '/[prefix]/[slug]') {
|
||||
const redirectUrl = CONFIG.POST_REDIRECT_URL + router.asPath.replace('?theme=landing', '')
|
||||
if (JSON.parse(siteConfig('LANDING_POST_REDIRECT_ENABLE', null, CONFIG)) && isBrowser && router.route == '/[prefix]/[slug]') {
|
||||
const redirectUrl = siteConfig('LANDING_POST_REDIRECT_URL', null, CONFIG) + router.asPath.replace('?theme=landing', '')
|
||||
router.push(redirectUrl)
|
||||
return <div id='theme-landing'><Loading /></div>
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import CONFIG from '../config'
|
||||
import BlogPostCard from './BlogPostCard'
|
||||
import { siteConfig } from '@/lib/config'
|
||||
|
||||
/**
|
||||
* 上一篇,下一篇文章
|
||||
@@ -7,7 +8,7 @@ import BlogPostCard from './BlogPostCard'
|
||||
* @returns
|
||||
*/
|
||||
export default function ArticleAdjacent ({ prev, next, siteInfo }) {
|
||||
if (!prev || !next || !CONFIG.ARTICLE_ADJACENT) {
|
||||
if (!prev || !next || !siteConfig('MATERY_ARTICLE_ADJACENT', null, CONFIG)) {
|
||||
return <></>
|
||||
}
|
||||
return <section className='flex flex-col justify-between p-3 text-gray-800 items-center text-xs md:text-sm md:flex-row md:gap-2 '>
|
||||
|
||||
@@ -14,7 +14,7 @@ export default function ArticleCopyright () {
|
||||
|
||||
const { locale } = useGlobal()
|
||||
|
||||
if (!CONFIG.ARTICLE_COPYRIGHT) {
|
||||
if (!siteConfig('MATERY_ARTICLE_COPYRIGHT', null, CONFIG)) {
|
||||
return <></>
|
||||
}
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ export default function ArticleRecommend({ recommendPosts, siteInfo }) {
|
||||
const { locale } = useGlobal()
|
||||
|
||||
if (
|
||||
!CONFIG.ARTICLE_RECOMMEND ||
|
||||
!siteConfig('MATERY_ARTICLE_RECOMMEND', null, CONFIG) ||
|
||||
!recommendPosts ||
|
||||
recommendPosts.length === 0
|
||||
) {
|
||||
|
||||
@@ -8,12 +8,12 @@ import { formatDateFmt } from '@/lib/formatDate'
|
||||
// import Image from 'next/image'
|
||||
|
||||
const BlogPostCard = ({ index, post, showSummary, siteInfo }) => {
|
||||
const showPreview = CONFIG.POST_LIST_PREVIEW && post.blockMap
|
||||
const showPreview = siteConfig('MATERY_POST_LIST_PREVIEW', null, CONFIG) && post.blockMap
|
||||
// matery 主题默认强制显示图片
|
||||
if (post && !post.pageCoverThumbnail) {
|
||||
post.pageCoverThumbnail = siteInfo?.pageCover
|
||||
}
|
||||
const showPageCover = CONFIG.POST_LIST_COVER && post?.pageCoverThumbnail
|
||||
const showPageCover = siteConfig('MATERY_POST_LIST_COVER', null, CONFIG) && post?.pageCoverThumbnail
|
||||
const delay = (index % 3) * 300
|
||||
return (
|
||||
<div
|
||||
|
||||
@@ -14,7 +14,7 @@ import throttle from 'lodash.throttle'
|
||||
* @returns {JSX.Element}
|
||||
* @constructor
|
||||
*/
|
||||
const BlogPostListScroll = ({ posts = [], currentSearch, showSummary = CONFIG.POST_LIST_SUMMARY, siteInfo }) => {
|
||||
const BlogPostListScroll = ({ posts = [], currentSearch, showSummary = siteConfig('MATERY_POST_LIST_SUMMARY', null, CONFIG), siteInfo }) => {
|
||||
const postsPerPage = parseInt(siteConfig('POSTS_PER_PAGE'))
|
||||
const [page, updatePage] = useState(1)
|
||||
const postsToShow = getListByPage(posts, page, postsPerPage)
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
import { useGlobal } from '@/lib/global'
|
||||
import { saveDarkModeToCookies } from '@/themes/theme'
|
||||
import CONFIG from '../config'
|
||||
import { siteConfig } from '@/lib/config'
|
||||
|
||||
export default function FloatDarkModeButton() {
|
||||
const { isDarkMode, updateDarkMode } = useGlobal()
|
||||
|
||||
if (!CONFIG.WIDGET_DARK_MODE) {
|
||||
if (!siteConfig('WIDGET_DARK_MODE', null, CONFIG)) {
|
||||
return <></>
|
||||
}
|
||||
|
||||
|
||||
@@ -62,12 +62,12 @@ const Hero = props => {
|
||||
{/* 滚动按钮 */}
|
||||
<div onClick={() => { window.scrollTo({ top: wrapperTop, behavior: 'smooth' }) }}
|
||||
className="mt-12 border cursor-pointer w-40 text-center pt-4 pb-3 text-md text-white hover:bg-orange-600 duration-300 rounded-3xl z-40">
|
||||
<i className='animate-bounce fas fa-angle-double-down' /> <span>{CONFIG.SHOW_START_READING && locale.COMMON.START_READING}</span>
|
||||
<i className='animate-bounce fas fa-angle-double-down' /> <span>{siteConfig('MATERY_SHOW_START_READING', null, CONFIG) && locale.COMMON.START_READING}</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<LazyImage priority={true} id='header-cover'src={siteInfo?.pageCover}
|
||||
className={`header-cover object-center w-full h-screen object-cover ${CONFIG.HOME_NAV_BACKGROUND_IMG_FIXED ? 'fixed' : ''}`} />
|
||||
className={`header-cover object-center w-full h-screen object-cover ${siteConfig('MATERY_HOME_NAV_BACKGROUND_IMG_FIXED', null, CONFIG) ? 'fixed' : ''}`} />
|
||||
|
||||
</header>
|
||||
)
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import CONFIG from '../config'
|
||||
import { siteConfig } from '@/lib/config'
|
||||
|
||||
/**
|
||||
* 跳转到评论区
|
||||
@@ -6,7 +7,7 @@ import CONFIG from '../config'
|
||||
* @constructor
|
||||
*/
|
||||
const JumpToCommentButton = () => {
|
||||
if (!CONFIG.WIDGET_TO_COMMENT) {
|
||||
if (!siteConfig('MATERY_WIDGET_TO_COMMENT', null, CONFIG)) {
|
||||
return <></>
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { useGlobal } from '@/lib/global'
|
||||
import CONFIG from '../config'
|
||||
import { siteConfig } from '@/lib/config'
|
||||
|
||||
/**
|
||||
* 跳转到网页顶部
|
||||
@@ -12,7 +13,7 @@ import CONFIG from '../config'
|
||||
const JumpToTopButton = ({ showPercent = true, percent }) => {
|
||||
const { locale } = useGlobal()
|
||||
|
||||
if (!CONFIG.WIDGET_TO_TOP) {
|
||||
if (!siteConfig('MATERY_WIDGET_TO_TOP', null, CONFIG)) {
|
||||
return <></>
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import Link from 'next/link'
|
||||
import { useGlobal } from '@/lib/global'
|
||||
import CONFIG from '../config'
|
||||
import { siteConfig } from '@/lib/config'
|
||||
|
||||
const MenuGroupCard = (props) => {
|
||||
const { postCount, categories, tags } = props
|
||||
@@ -10,9 +11,9 @@ const MenuGroupCard = (props) => {
|
||||
const tagSlot = <div className='text-center'>{tags?.length}</div>
|
||||
|
||||
const links = [
|
||||
{ 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 }
|
||||
{ name: locale.COMMON.ARTICLE, to: '/archive', slot: archiveSlot, show: siteConfig('MATERY_MENU_ARCHIVE', null, CONFIG) },
|
||||
{ name: locale.COMMON.CATEGORY, to: '/category', slot: categorySlot, show: siteConfig('MATERY_MENU_CATEGORY', null, CONFIG) },
|
||||
{ name: locale.COMMON.TAGS, to: '/tag', slot: tagSlot, show: siteConfig('MATERY_MENU_TAG', null, CONFIG) }
|
||||
]
|
||||
|
||||
return (
|
||||
|
||||
@@ -2,6 +2,7 @@ import Link from 'next/link'
|
||||
import { useRouter } from 'next/router'
|
||||
import { useGlobal } from '@/lib/global'
|
||||
import CONFIG from '../config'
|
||||
import { siteConfig } from '@/lib/config'
|
||||
|
||||
const MenuList = (props) => {
|
||||
const { postCount, customNav } = props
|
||||
@@ -11,10 +12,10 @@ const MenuList = (props) => {
|
||||
|
||||
let links = [
|
||||
{ icon: 'fas fa-home', name: locale.NAV.INDEX, to: '/' || '/', show: true },
|
||||
{ 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', slot: archiveSlot, show: CONFIG.MENU_ARCHIVE },
|
||||
{ icon: 'fas fa-search', name: locale.NAV.SEARCH, to: '/search', show: CONFIG.MENU_SEARCH }
|
||||
{ icon: 'fas fa-th', name: locale.COMMON.CATEGORY, to: '/category', show: siteConfig('MATERY_MENU_CATEGORY', null, CONFIG) },
|
||||
{ icon: 'fas fa-tag', name: locale.COMMON.TAGS, to: '/tag', show: siteConfig('MATERY_MENU_TAG', null, CONFIG) },
|
||||
{ icon: 'fas fa-archive', name: locale.NAV.ARCHIVE, to: '/archive', slot: archiveSlot, show: siteConfig('MATERY_MENU_ARCHIVE', null, CONFIG) },
|
||||
{ icon: 'fas fa-search', name: locale.NAV.SEARCH, to: '/search', show: siteConfig('MATERY_MENU_SEARCH', null, CONFIG) }
|
||||
]
|
||||
if (customNav) {
|
||||
links = links.concat(customNav)
|
||||
|
||||
@@ -8,10 +8,10 @@ export const MenuListSide = (props) => {
|
||||
const { locale } = useGlobal()
|
||||
|
||||
let links = [
|
||||
{ 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 }
|
||||
{ icon: 'fas fa-archive', name: locale.NAV.ARCHIVE, to: '/archive', show: siteConfig('MATERY_MENU_ARCHIVE', null, CONFIG) },
|
||||
{ icon: 'fas fa-search', name: locale.NAV.SEARCH, to: '/search', show: siteConfig('MATERY_MENU_SEARCH', null, CONFIG) },
|
||||
{ icon: 'fas fa-folder', name: locale.COMMON.CATEGORY, to: '/category', show: siteConfig('MATERY_MENU_CATEGORY', null, CONFIG) },
|
||||
{ icon: 'fas fa-tag', name: locale.COMMON.TAGS, to: '/tag', show: siteConfig('MATERY_MENU_TAG', null, CONFIG) }
|
||||
]
|
||||
|
||||
if (customNav) {
|
||||
|
||||
@@ -8,10 +8,10 @@ export const MenuListTop = (props) => {
|
||||
const { locale } = useGlobal()
|
||||
|
||||
let links = [
|
||||
{ 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 }
|
||||
{ icon: 'fas fa-archive', name: locale.NAV.ARCHIVE, to: '/archive', show: siteConfig('MATERY_MENU_ARCHIVE', null, CONFIG) },
|
||||
{ icon: 'fas fa-search', name: locale.NAV.SEARCH, to: '/search', show: siteConfig('MATERY_MENU_SEARCH', null, CONFIG) },
|
||||
{ icon: 'fas fa-folder', name: locale.COMMON.CATEGORY, to: '/category', show: siteConfig('MATERY_MENU_CATEGORY', null, CONFIG) },
|
||||
{ icon: 'fas fa-tag', name: locale.COMMON.TAGS, to: '/tag', show: siteConfig('MATERY_MENU_TAG', null, CONFIG) }
|
||||
]
|
||||
|
||||
if (customNav) {
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { useGlobal } from '@/lib/global'
|
||||
import CONFIG from '../config'
|
||||
import { siteConfig } from '@/lib/config'
|
||||
|
||||
/**
|
||||
* 点击召唤目录抽屉
|
||||
@@ -10,7 +11,7 @@ import CONFIG from '../config'
|
||||
*/
|
||||
const TocDrawerButton = (props) => {
|
||||
const { locale } = useGlobal()
|
||||
if (!CONFIG.WIDGET_TOC) {
|
||||
if (!siteConfig('MATERY_WIDGET_TOC', null, CONFIG)) {
|
||||
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} >
|
||||
|
||||
@@ -1,33 +1,33 @@
|
||||
const CONFIG = {
|
||||
HOME_BANNER_ENABLE: true,
|
||||
MATERY_HOME_BANNER_ENABLE: true,
|
||||
// 3.14.1以后的版本中,欢迎语在blog.config.js中配置,用英文逗号','隔开多个。
|
||||
HOME_BANNER_GREETINGS: ['Hi,我是一个程序员', 'Hi,我是一个打工人', 'Hi,我是一个干饭人', '欢迎来到我的博客🎉'], // 首页大图标语文字
|
||||
MATERY_HOME_BANNER_GREETINGS: ['Hi,我是一个程序员', 'Hi,我是一个打工人', 'Hi,我是一个干饭人', '欢迎来到我的博客🎉'], // 首页大图标语文字
|
||||
|
||||
HOME_NAV_BUTTONS: true, // 首页是否显示分类大图标按钮
|
||||
HOME_NAV_BACKGROUND_IMG_FIXED: false, // 首页背景图滚动时是否固定,true 则滚动时图片不懂; false则随鼠标滚动
|
||||
MATERY_HOME_NAV_BUTTONS: true, // 首页是否显示分类大图标按钮
|
||||
MATERY_HOME_NAV_BACKGROUND_IMG_FIXED: false, // 首页背景图滚动时是否固定,true 则滚动时图片不懂; false则随鼠标滚动
|
||||
|
||||
// 是否显示开始阅读按钮
|
||||
SHOW_START_READING: true,
|
||||
MATERY_SHOW_START_READING: true,
|
||||
|
||||
// 菜单配置
|
||||
MENU_CATEGORY: true, // 显示分类
|
||||
MENU_TAG: true, // 显示标签
|
||||
MENU_ARCHIVE: true, // 显示归档
|
||||
MENU_SEARCH: true, // 显示搜索
|
||||
MATERY_MENU_CATEGORY: true, // 显示分类
|
||||
MATERY_MENU_TAG: true, // 显示标签
|
||||
MATERY_MENU_ARCHIVE: true, // 显示归档
|
||||
MATERY_MENU_SEARCH: true, // 显示搜索
|
||||
|
||||
POST_LIST_COVER: true, // 文章封面
|
||||
POST_LIST_SUMMARY: true, // 文章摘要
|
||||
POST_LIST_PREVIEW: true, // 读取文章预览
|
||||
MATERY_POST_LIST_COVER: true, // 文章封面
|
||||
MATERY_POST_LIST_SUMMARY: true, // 文章摘要
|
||||
MATERY_POST_LIST_PREVIEW: true, // 读取文章预览
|
||||
|
||||
ARTICLE_ADJACENT: true, // 显示上一篇下一篇文章推荐
|
||||
ARTICLE_COPYRIGHT: true, // 显示文章版权声明
|
||||
ARTICLE_RECOMMEND: true, // 文章关联推荐
|
||||
MATERY_ARTICLE_ADJACENT: true, // 显示上一篇下一篇文章推荐
|
||||
MATERY_ARTICLE_COPYRIGHT: true, // 显示文章版权声明
|
||||
MATERY_ARTICLE_RECOMMEND: true, // 文章关联推荐
|
||||
|
||||
WIDGET_LATEST_POSTS: true, // 显示最新文章卡
|
||||
WIDGET_ANALYTICS: false, // 显示统计卡
|
||||
WIDGET_TO_TOP: true,
|
||||
WIDGET_TO_COMMENT: true, // 跳到评论区
|
||||
MATERY_WIDGET_LATEST_POSTS: true, // 显示最新文章卡
|
||||
MATERY_WIDGET_ANALYTICS: false, // 显示统计卡
|
||||
MATERY_WIDGET_TO_TOP: true,
|
||||
MATERY_WIDGET_TO_COMMENT: true, // 跳到评论区
|
||||
WIDGET_DARK_MODE: true, // 夜间模式
|
||||
WIDGET_TOC: true // 移动端悬浮目录
|
||||
MATERY_WIDGET_TOC: true // 移动端悬浮目录
|
||||
}
|
||||
export default CONFIG
|
||||
|
||||
@@ -67,7 +67,7 @@ const LayoutBase = props => {
|
||||
{headerSlot}
|
||||
</Transition>
|
||||
|
||||
<main id="wrapper" className={`${CONFIG.HOME_BANNER_ENABLE ? '' : 'pt-16'} flex-1 w-full py-8 md:px-8 lg:px-24 relative`}>
|
||||
<main id="wrapper" className={`${siteConfig('MATERY_HOME_BANNER_ENABLE', null, CONFIG) ? '' : 'pt-16'} flex-1 w-full py-8 md:px-8 lg:px-24 relative`}>
|
||||
{/* 嵌入区域 */}
|
||||
<div id="container-slot" className={`w-full max-w-6xl ${post && ' lg:max-w-3xl 2xl:max-w-4xl '} mt-6 px-3 mx-auto lg:flex lg:space-x-4 justify-center relative z-10`}>
|
||||
{containerSlot}
|
||||
@@ -113,7 +113,7 @@ const LayoutBase = props => {
|
||||
* @returns
|
||||
*/
|
||||
const LayoutIndex = (props) => {
|
||||
return <LayoutPostList {...props} containerSlot={<Announcement {...props} />} headerSlot={CONFIG.HOME_BANNER_ENABLE && <Hero {...props} />} />
|
||||
return <LayoutPostList {...props} containerSlot={<Announcement {...props} />} headerSlot={siteConfig('MATERY_HOME_BANNER_ENABLE', null, CONFIG) && <Hero {...props} />} />
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -9,7 +9,7 @@ import TwikooCommentCount from '@/components/TwikooCommentCount'
|
||||
import LazyImage from '@/components/LazyImage'
|
||||
|
||||
const BlogPostCard = ({ post, showSummary }) => {
|
||||
const showPreview = CONFIG.POST_LIST_PREVIEW && post.blockMap
|
||||
const showPreview = siteConfig('MEDIUM_POST_LIST_PREVIEW', null, CONFIG) && post.blockMap
|
||||
const { locale } = useGlobal()
|
||||
return (
|
||||
<div
|
||||
@@ -29,7 +29,7 @@ const BlogPostCard = ({ post, showSummary }) => {
|
||||
'cursor-pointer font-bold hover:underline text-3xl leading-tight text-gray-700 dark:text-gray-300 hover:text-green-500 dark:hover:text-green-400'
|
||||
}>
|
||||
<div>
|
||||
{CONFIG.POST_LIST_COVER && <div className='w-full max-h-96 object-cover overflow-hidden mb-2'>
|
||||
{siteConfig('MEDIUM_POST_LIST_COVER', null, CONFIG) && <div className='w-full max-h-96 object-cover overflow-hidden mb-2'>
|
||||
<LazyImage src={post.pageCoverThumbnail} style={post.pageCoverThumbnail ? {} : { height: '0px' }} className='w-full max-h-96 object-cover hover:scale-125 duration-150' />
|
||||
</div>}
|
||||
{post.title}
|
||||
@@ -43,8 +43,8 @@ const BlogPostCard = ({ post, showSummary }) => {
|
||||
}
|
||||
>
|
||||
<div className="text-sm py-1">{post.date?.start_date}</div>
|
||||
{CONFIG.POST_LIST_CATEGORY && <CategoryItem category={post.category} />}
|
||||
{CONFIG.POST_LIST_TAG && post?.tagItems?.map(tag => <TagItemMini key={tag.name} tag={tag} />)}
|
||||
{siteConfig('MEDIUM_POST_LIST_CATEGORY', null, CONFIG) && <CategoryItem category={post.category} />}
|
||||
{siteConfig('MEDIUM_POST_LIST_TAG', null, CONFIG) && post?.tagItems?.map(tag => <TagItemMini key={tag.name} tag={tag} />)}
|
||||
<TwikooCommentCount post={post} className='hover:underline'/>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import CONFIG from '../config'
|
||||
import { siteConfig } from '@/lib/config'
|
||||
|
||||
/**
|
||||
* 跳转到网页顶部
|
||||
@@ -9,7 +10,7 @@ import CONFIG from '../config'
|
||||
* @constructor
|
||||
*/
|
||||
const JumpToTopButton = ({ showPercent = false, percent, className }) => {
|
||||
if (!CONFIG.WIDGET_TO_TOP) {
|
||||
if (!siteConfig('MEDIUM_WIDGET_TO_TOP', null, CONFIG)) {
|
||||
return <></>
|
||||
}
|
||||
return (
|
||||
|
||||
@@ -9,10 +9,10 @@ export const MenuBarMobile = (props) => {
|
||||
|
||||
let links = [
|
||||
// { name: locale.NAV.INDEX, to: '/' || '/', show: true },
|
||||
{ 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 }
|
||||
{ name: locale.COMMON.CATEGORY, to: '/category', show: siteConfig('MEDIUM_MENU_CATEGORY', null, CONFIG) },
|
||||
{ name: locale.COMMON.TAGS, to: '/tag', show: siteConfig('MEDIUM_MENU_TAG', null, CONFIG) },
|
||||
{ name: locale.NAV.ARCHIVE, to: '/archive', show: siteConfig('MEDIUM_MENU_ARCHIVE', null, CONFIG) }
|
||||
// { name: locale.NAV.SEARCH, to: '/search', show: siteConfig('MENU_SEARCH', null, CONFIG) }
|
||||
]
|
||||
|
||||
if (customNav) {
|
||||
|
||||
@@ -20,10 +20,10 @@ export default function TopNavBar(props) {
|
||||
const { locale } = useGlobal()
|
||||
|
||||
const defaultLinks = [
|
||||
{ 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 }
|
||||
{ icon: 'fas fa-th', name: locale.COMMON.CATEGORY, to: '/category', show: siteConfig('MEDIUM_MENU_CATEGORY', null, CONFIG) },
|
||||
{ icon: 'fas fa-tag', name: locale.COMMON.TAGS, to: '/tag', show: siteConfig('MEDIUM_MENU_TAG', null, CONFIG) },
|
||||
{ icon: 'fas fa-archive', name: locale.NAV.ARCHIVE, to: '/archive', show: siteConfig('MEDIUM_MENU_ARCHIVE', null, CONFIG) },
|
||||
{ icon: 'fas fa-search', name: locale.NAV.SEARCH, to: '/search', show: siteConfig('MEDIUM_MENU_SEARCH', null, CONFIG) }
|
||||
]
|
||||
|
||||
let links = defaultLinks.concat(customNav)
|
||||
|
||||
@@ -1,24 +1,24 @@
|
||||
const CONFIG = {
|
||||
|
||||
// Style
|
||||
RIGHT_PANEL_DARK: process.env.NEXT_PUBLIC_MEDIUM_RIGHT_DARK || false, // 右侧面板深色模式
|
||||
MEDIUM_RIGHT_PANEL_DARK: process.env.NEXT_PUBLIC_MEDIUM_RIGHT_DARK || false, // 右侧面板深色模式
|
||||
|
||||
POST_LIST_COVER: true, // 文章列表显示图片封面
|
||||
POST_LIST_PREVIEW: true, // 列表显示文章预览
|
||||
POST_LIST_CATEGORY: true, // 列表显示文章分类
|
||||
POST_LIST_TAG: true, // 列表显示文章标签
|
||||
MEDIUM_POST_LIST_COVER: true, // 文章列表显示图片封面
|
||||
MEDIUM_POST_LIST_PREVIEW: true, // 列表显示文章预览
|
||||
MEDIUM_POST_LIST_CATEGORY: true, // 列表显示文章分类
|
||||
MEDIUM_POST_LIST_TAG: true, // 列表显示文章标签
|
||||
|
||||
POST_DETAIL_CATEGORY: true, // 文章显示分类
|
||||
POST_DETAIL_TAG: true, // 文章显示标签
|
||||
MEDIUM_POST_DETAIL_CATEGORY: true, // 文章显示分类
|
||||
MEDIUM_POST_DETAIL_TAG: true, // 文章显示标签
|
||||
|
||||
// 菜单
|
||||
MENU_CATEGORY: true, // 显示分类
|
||||
MENU_TAG: true, // 显示标签
|
||||
MENU_ARCHIVE: true, // 显示归档
|
||||
MENU_SEARCH: true, // 显示搜索
|
||||
MEDIUM_MENU_CATEGORY: true, // 显示分类
|
||||
MEDIUM_MENU_TAG: true, // 显示标签
|
||||
MEDIUM_MENU_ARCHIVE: true, // 显示归档
|
||||
MEDIUM_MENU_SEARCH: true, // 显示搜索
|
||||
|
||||
// Widget
|
||||
WIDGET_REVOLVER_MAPS: process.env.NEXT_PUBLIC_WIDGET_REVOLVER_MAPS || 'false', // 地图插件
|
||||
WIDGET_TO_TOP: true // 跳回顶部
|
||||
MEDIUM_WIDGET_REVOLVER_MAPS: process.env.NEXT_PUBLIC_WIDGET_REVOLVER_MAPS || 'false', // 地图插件
|
||||
MEDIUM_WIDGET_TO_TOP: true // 跳回顶部
|
||||
}
|
||||
export default CONFIG
|
||||
|
||||
@@ -96,14 +96,14 @@ const LayoutBase = props => {
|
||||
</div>
|
||||
|
||||
{/* 桌面端右侧 */}
|
||||
<div className={`hidden xl:block border-l dark:border-transparent w-96 relative z-10 ${CONFIG.RIGHT_PANEL_DARK ? 'bg-hexo-black-gray dark' : ''}`}>
|
||||
<div className={`hidden xl:block border-l dark:border-transparent w-96 relative z-10 ${siteConfig('MEDIUM_RIGHT_PANEL_DARK', null, CONFIG) ? 'bg-hexo-black-gray dark' : ''}`}>
|
||||
<div className='py-14 px-6 sticky top-0'>
|
||||
<Tabs>
|
||||
{slotRight}
|
||||
<div key={locale.NAV.ABOUT}>
|
||||
{router.pathname !== '/search' && <SearchInput className='mt-6 mb-12' />}
|
||||
{showInfoCard && <InfoCard {...props} />}
|
||||
{CONFIG.WIDGET_REVOLVER_MAPS === 'true' && <RevolverMaps />}
|
||||
{siteConfig('MEDIUM_WIDGET_REVOLVER_MAPS', null, CONFIG) === 'true' && <RevolverMaps />}
|
||||
</div>
|
||||
</Tabs>
|
||||
<Announcement post={notice} />
|
||||
@@ -175,9 +175,9 @@ const LayoutSlug = props => {
|
||||
<ShareBar post={post} />
|
||||
{/* 文章分类和标签信息 */}
|
||||
<div className='flex justify-between'>
|
||||
{CONFIG.POST_DETAIL_CATEGORY && post?.category && <CategoryItem category={post?.category} />}
|
||||
{siteConfig('MEDIUM_POST_DETAIL_CATEGORY', null, CONFIG) && post?.category && <CategoryItem category={post?.category} />}
|
||||
<div>
|
||||
{CONFIG.POST_DETAIL_TAG && post?.tagItems?.map(tag => <TagItemMini key={tag.name} tag={tag} />)}
|
||||
{siteConfig('MEDIUM_POST_DETAIL_TAG', null, CONFIG) && post?.tagItems?.map(tag => <TagItemMini key={tag.name} tag={tag} />)}
|
||||
</div>
|
||||
</div>
|
||||
{/* 上一篇下一篇文章 */}
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
/* eslint-disable */
|
||||
import BlogPostListEmpty from './BlogPostListEmpty'
|
||||
import { useRouter } from 'next/router'
|
||||
import BlogPostItem from './BlogPostItem'
|
||||
import { useNavGlobal } from '@/themes/nav'
|
||||
import CONFIG from '../config'
|
||||
import { deepClone } from '@/lib/utils'
|
||||
import { useEffect, useState, createContext, useContext } from 'react'
|
||||
import { siteConfig } from '@/lib/config'
|
||||
|
||||
/**
|
||||
* 博客列表滚动分页
|
||||
@@ -21,22 +20,22 @@ const BlogPostListAll = (props) => {
|
||||
// const [filteredNavPages, setFilteredNavPages] = useState(allNavPages)
|
||||
const { filteredNavPages, setFilteredNavPages, allNavPages } = useNavGlobal()
|
||||
// const [filteredNavPages] = useState(allNavPages)
|
||||
|
||||
|
||||
// const router = useRouter()
|
||||
// 对自定义分类格式化,方便后续使用分类名称做索引,检索同步图标信息
|
||||
// 目前只支持二级分类
|
||||
let links = customMenu
|
||||
let filterLinks = {}
|
||||
const links = customMenu
|
||||
const filterLinks = {}
|
||||
// for循环遍历数组
|
||||
links?.map((link, i) => {
|
||||
let linkTitle = link.title + ''
|
||||
const linkTitle = link.title + ''
|
||||
// console.log('####### link')
|
||||
// console.log(link)
|
||||
// filterLinks[linkTitle] = link
|
||||
filterLinks[linkTitle] = { title: link.title, icon: link.icon, pageIcon: link.pageIcon }
|
||||
if(link?.subMenus){
|
||||
filterLinks[linkTitle] = { title: link.title, icon: link.icon, pageIcon: link.pageIcon }
|
||||
if (link?.subMenus) {
|
||||
link.subMenus?.map((group, index) => {
|
||||
let subMenuTitle = group?.title + ''
|
||||
const subMenuTitle = group?.title + ''
|
||||
// 自定义分类图标与post的category共用
|
||||
// 判断自定义分类与Post中category同名的项,将icon的值传递给post
|
||||
// filterLinks[subMenuTitle] = group
|
||||
@@ -44,18 +43,17 @@ const BlogPostListAll = (props) => {
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
console.log('####### filterLinks')
|
||||
console.log(filterLinks)
|
||||
|
||||
|
||||
// console.log('####### filterLinks')
|
||||
// console.log(filterLinks)
|
||||
|
||||
let selectedSth = false
|
||||
const selectedSth = false
|
||||
const groupedArray = filteredNavPages?.reduce((groups, item) => {
|
||||
let categoryName = item?.category ? item?.category : '' // 将category转换为字符串
|
||||
let categoryIcon = filterLinks[categoryName]?.icon ? filterLinks[categoryName]?.icon : '' // 将pageIcon转换为字符串
|
||||
const categoryName = item?.category ? item?.category : '' // 将category转换为字符串
|
||||
const categoryIcon = filterLinks[categoryName]?.icon ? filterLinks[categoryName]?.icon : '' // 将pageIcon转换为字符串
|
||||
|
||||
// console.log('####### categoryName')
|
||||
// console.log(categoryName)
|
||||
@@ -64,7 +62,7 @@ const BlogPostListAll = (props) => {
|
||||
|
||||
let existingGroup = null
|
||||
// 开启自动分组排序
|
||||
if (JSON.parse(CONFIG.AUTO_SORT)) {
|
||||
if (JSON.parse(siteConfig('NAV_AUTO_SORT', null, CONFIG))) {
|
||||
existingGroup = groups.find(group => group.category === categoryName) // 搜索同名的最后一个分组
|
||||
} else {
|
||||
existingGroup = groups[groups.length - 1] // 获取最后一个分组
|
||||
@@ -87,7 +85,7 @@ const BlogPostListAll = (props) => {
|
||||
// item.icon = filterLinks[categoryName]?.icon ? filterLinks[categoryName]?.icon : ''
|
||||
// console.log('####### item')
|
||||
// console.log(item)
|
||||
let groupSelected = false
|
||||
const groupSelected = false
|
||||
// for (const post of group?.items) {
|
||||
// if (router.asPath.split('?')[0] === '/' + post.slug) {
|
||||
// groupSelected = true
|
||||
@@ -133,7 +131,6 @@ const BlogPostListAll = (props) => {
|
||||
// filterPosts.push(filterGroup)
|
||||
// }
|
||||
// }
|
||||
|
||||
}
|
||||
|
||||
export default BlogPostListAll
|
||||
|
||||
@@ -16,7 +16,7 @@ export default function LogoBar(props) {
|
||||
{/* eslint-disable-next-line @next/next/no-img-element */}
|
||||
<img src={siteInfo?.icon?.replaceAll('width=400', 'width=280')}
|
||||
height='44px' alt={siteConfig('AUTHOR') + ' - ' + siteConfig('NEXT_PUBLIC_BIO')} className='md:block transition-all hover:scale-110 duration-150' placeholderSrc='' />
|
||||
{CONFIG.SHOW_TITLE_TEXT && siteConfig('TITLE')}
|
||||
{siteConfig('NAV_SHOW_TITLE_TEXT', null, CONFIG) && siteConfig('TITLE')}
|
||||
</Link>
|
||||
</div>
|
||||
)
|
||||
|
||||
@@ -14,10 +14,10 @@ export const MenuBarMobile = (props) => {
|
||||
|
||||
let links = [
|
||||
// { name: locale.NAV.INDEX, to: '/' || '/', show: true },
|
||||
{ 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 }
|
||||
{ name: locale.COMMON.CATEGORY, to: '/category', show: siteConfig('NAV_MENU_CATEGORY', null, CONFIG) },
|
||||
{ name: locale.COMMON.TAGS, to: '/tag', show: siteConfig('NAV_MENU_TAG', null, CONFIG) },
|
||||
{ name: locale.NAV.ARCHIVE, to: '/archive', show: siteConfig('NAV_MENU_ARCHIVE', null, CONFIG) }
|
||||
// { name: locale.NAV.SEARCH, to: '/search', show: siteConfig('MENU_SEARCH', null, CONFIG) }
|
||||
]
|
||||
|
||||
if (customNav) {
|
||||
|
||||
@@ -1,20 +1,20 @@
|
||||
const CONFIG = {
|
||||
|
||||
INDEX_PAGE: 'about', // 文档首页显示的文章,请确此路径包含在您的notion数据库中
|
||||
NAV_INDEX_PAGE: 'about', // 文档首页显示的文章,请确此路径包含在您的notion数据库中
|
||||
|
||||
AUTO_SORT: process.env.NEXT_PUBLIC_GITBOOK_AUTO_SORT || true, // 是否自动按分类名 归组排序文章;自动归组可能会打乱您Notion中的文章顺序
|
||||
NAV_AUTO_SORT: process.env.NEXT_PUBLIC_GITBOOK_AUTO_SORT || true, // 是否自动按分类名 归组排序文章;自动归组可能会打乱您Notion中的文章顺序
|
||||
|
||||
SHOW_TITLE_TEXT: false, // 标题栏显示文本
|
||||
USE_CUSTOM_MENU: true, // 使用自定义菜单(可支持子菜单,支持自定义分类图标),若为true则显示所有的category分类
|
||||
NAV_SHOW_TITLE_TEXT: false, // 标题栏显示文本
|
||||
NAV_USE_CUSTOM_MENU: true, // 使用自定义菜单(可支持子菜单,支持自定义分类图标),若为true则显示所有的category分类
|
||||
|
||||
// 菜单
|
||||
MENU_CATEGORY: true, // 显示分类
|
||||
MENU_TAG: true, // 显示标签
|
||||
MENU_ARCHIVE: true, // 显示归档
|
||||
MENU_SEARCH: true, // 显示搜索
|
||||
NAV_MENU_CATEGORY: true, // 显示分类
|
||||
NAV_MENU_TAG: true, // 显示标签
|
||||
NAV_MENU_ARCHIVE: true, // 显示归档
|
||||
NAV_MENU_SEARCH: true, // 显示搜索
|
||||
|
||||
// Widget
|
||||
WIDGET_REVOLVER_MAPS: process.env.NEXT_PUBLIC_WIDGET_REVOLVER_MAPS || 'false', // 地图插件
|
||||
WIDGET_TO_TOP: true // 跳回顶部
|
||||
NAV_WIDGET_REVOLVER_MAPS: process.env.NEXT_PUBLIC_WIDGET_REVOLVER_MAPS || 'false', // 地图插件
|
||||
NAV_WIDGET_TO_TOP: true // 跳回顶部
|
||||
}
|
||||
export default CONFIG
|
||||
|
||||
@@ -61,7 +61,7 @@ const LayoutBase = (props) => {
|
||||
let links = customMenu
|
||||
|
||||
// 默认使用自定义菜单,否则将遍历所有的category生成菜单
|
||||
if (!CONFIG.USE_CUSTOM_MENU) {
|
||||
if (!siteConfig('NAV_USE_CUSTOM_MENU', null, CONFIG)) {
|
||||
links = categoryOptions && categoryOptions?.map(c => {
|
||||
return { id: c.name, title: `# ${c.name}`, to: `/category/${c.name}`, show: true }
|
||||
})
|
||||
@@ -227,9 +227,9 @@ const LayoutSlug = (props) => {
|
||||
{/* <ShareBar post={post} /> */}
|
||||
{/* 文章分类和标签信息 */}
|
||||
<div className='flex justify-between'>
|
||||
{CONFIG.POST_DETAIL_CATEGORY && post?.category && <CategoryItem category={post.category} />}
|
||||
{siteConfig('POST_DETAIL_CATEGORY', null, CONFIG) && post?.category && <CategoryItem category={post.category} />}
|
||||
<div>
|
||||
{CONFIG.POST_DETAIL_TAG && post?.tagItems?.map(tag => <TagItemMini key={tag.name} tag={tag} />)}
|
||||
{siteConfig('POST_DETAIL_TAG', null, CONFIG) && post?.tagItems?.map(tag => <TagItemMini key={tag.name} tag={tag} />)}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
import { useGlobal } from '@/lib/global'
|
||||
import Link from 'next/link'
|
||||
import CONFIG from '../config'
|
||||
import { siteConfig } from '@/lib/config'
|
||||
|
||||
export default function ArticleCopyright ({ author, url }) {
|
||||
const { locale } = useGlobal()
|
||||
if (!CONFIG.ARTICLE_COPYRIGHT) {
|
||||
if (!siteConfig('NEXT_ARTICLE_COPYRIGHT', null, CONFIG)) {
|
||||
return <></>
|
||||
}
|
||||
return (
|
||||
|
||||
@@ -24,7 +24,7 @@ export default function ArticleDetail(props) {
|
||||
const { post, recommendPosts, prev, next } = props
|
||||
const url = siteConfig('LINK') + useRouter().asPath
|
||||
const { locale } = useGlobal()
|
||||
const showArticleInfo = CONFIG.ARTICLE_INFO
|
||||
const showArticleInfo = siteConfig('NEXT_ARTICLE_INFO', null, CONFIG)
|
||||
|
||||
return (
|
||||
<div id="article-wrapper"
|
||||
@@ -39,7 +39,7 @@ export default function ArticleDetail(props) {
|
||||
|
||||
{showArticleInfo && <header>
|
||||
{/* 头图 */}
|
||||
{CONFIG.POST_HEADER_IMAGE_VISIBLE && post?.type && !post?.type !== 'Page' && post?.pageCover && (
|
||||
{siteConfig('NEXT_POST_HEADER_IMAGE_VISIBLE', null, CONFIG) && post?.type && !post?.type !== 'Page' && post?.pageCover && (
|
||||
<div className="w-full relative md:flex-shrink-0 overflow-hidden">
|
||||
<LazyImage alt={post.title} src={post?.pageCover} className='object-center w-full' />
|
||||
</div>
|
||||
|
||||
@@ -12,7 +12,7 @@ import { siteConfig } from '@/lib/config'
|
||||
|
||||
const BlogPostCard = ({ post, showSummary }) => {
|
||||
const { locale } = useGlobal()
|
||||
const showPreview = CONFIG.POST_LIST_PREVIEW && post.blockMap
|
||||
const showPreview = siteConfig('NEXT_POST_LIST_PREVIEW', null, CONFIG) && post.blockMap
|
||||
return (
|
||||
<Card className="w-full">
|
||||
<div
|
||||
@@ -114,7 +114,7 @@ const BlogPostCard = ({ post, showSummary }) => {
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{CONFIG.POST_LIST_COVER && post?.pageCoverThumbnail && (
|
||||
{siteConfig('NEXT_POST_LIST_COVER', null, CONFIG) && post?.pageCoverThumbnail && (
|
||||
<Link href={`${siteConfig('SUB_PATH', '')}/${post.slug}`} passHref legacyBehavior>
|
||||
<div className="h-72 w-full relative duration-200 cursor-pointer transform overflow-hidden">
|
||||
<Image
|
||||
|
||||
@@ -13,7 +13,7 @@ import { siteConfig } from '@/lib/config'
|
||||
* @returns {JSX.Element}
|
||||
* @constructor
|
||||
*/
|
||||
const BlogPostListScroll = ({ posts = [], currentSearch, showSummary = CONFIG.POST_LIST_SUMMARY }) => {
|
||||
const BlogPostListScroll = ({ posts = [], currentSearch, showSummary = siteConfig('NEXT_POST_LIST_SUMMARY', null, CONFIG) }) => {
|
||||
const postsPerPage = parseInt(siteConfig('POSTS_PER_PAGE'))
|
||||
const [page, updatePage] = useState(1)
|
||||
const postsToShow = getPostByPage(page, posts, postsPerPage)
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
import { useGlobal } from '@/lib/global'
|
||||
import { saveDarkModeToCookies } from '@/themes/theme'
|
||||
import CONFIG from '../config'
|
||||
import { siteConfig } from '@/lib/config'
|
||||
|
||||
export default function FloatDarkModeButton () {
|
||||
const { isDarkMode, updateDarkMode } = useGlobal()
|
||||
|
||||
if (!CONFIG.WIDGET_DARK_MODE) {
|
||||
if (!siteConfig('NEXT_WIDGET_DARK_MODE', null, CONFIG)) {
|
||||
return <></>
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { useEffect, useState } from 'react'
|
||||
import CONFIG from '../config'
|
||||
import { siteConfig } from '@/lib/config'
|
||||
|
||||
/**
|
||||
* 跳转到网页顶部
|
||||
@@ -37,7 +38,7 @@ const JumpToBottomButton = ({ showPercent = false }) => {
|
||||
window.scrollTo({ top: targetRef.clientHeight, behavior: 'smooth' })
|
||||
}
|
||||
|
||||
if (!CONFIG.WIDGET_TO_BOTTOM) {
|
||||
if (!siteConfig('NEXT_WIDGET_TO_BOTTOM', null, CONFIG)) {
|
||||
return <></>
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { useGlobal } from '@/lib/global'
|
||||
import CONFIG from '../config'
|
||||
import { siteConfig } from '@/lib/config'
|
||||
|
||||
/**
|
||||
* 跳转到网页顶部
|
||||
@@ -11,7 +12,7 @@ import CONFIG from '../config'
|
||||
*/
|
||||
const JumpToTopButton = ({ showPercent = true, percent }) => {
|
||||
const { locale } = useGlobal()
|
||||
if (!CONFIG.WIDGET_TO_TOP) {
|
||||
if (!siteConfig('NEXT_WIDGET_TO_TOP', null, CONFIG)) {
|
||||
return <></>
|
||||
}
|
||||
return (<div className='flex space-x-1 items-center transform hover:scale-105 duration-200 py-2 px-3' onClick={() => window.scrollTo({ top: 0, behavior: 'smooth' })} >
|
||||
|
||||
@@ -11,9 +11,9 @@ export const MenuList = (props) => {
|
||||
|
||||
const defaultLinks = [
|
||||
{ id: 1, icon: 'fas fa-home', name: locale.NAV.INDEX, to: '/' || '/', show: true },
|
||||
{ id: 2, icon: 'fas fa-th', name: locale.COMMON.CATEGORY, to: '/category', show: CONFIG.MENU_CATEGORY },
|
||||
{ id: 3, icon: 'fas fa-tag', name: locale.COMMON.TAGS, to: '/tag', show: CONFIG.MENU_TAG },
|
||||
{ id: 4, icon: 'fas fa-archive', name: locale.NAV.ARCHIVE, to: '/archive', slot: archiveSlot, show: CONFIG.MENU_ARCHIVE }
|
||||
{ id: 2, icon: 'fas fa-th', name: locale.COMMON.CATEGORY, to: '/category', show: siteConfig('NEXT_MENU_CATEGORY', null, CONFIG) },
|
||||
{ id: 3, icon: 'fas fa-tag', name: locale.COMMON.TAGS, to: '/tag', show: siteConfig('NEXT_MENU_TAG', null, CONFIG) },
|
||||
{ id: 4, icon: 'fas fa-archive', name: locale.NAV.ARCHIVE, to: '/archive', slot: archiveSlot, show: siteConfig('NEXT_MENU_ARCHIVE', null, CONFIG) }
|
||||
]
|
||||
|
||||
let links = [].concat(defaultLinks)
|
||||
|
||||
@@ -1,13 +1,14 @@
|
||||
import Link from 'next/link'
|
||||
import { useGlobal } from '@/lib/global'
|
||||
import CONFIG from '../config'
|
||||
import { siteConfig } from '@/lib/config'
|
||||
|
||||
/**
|
||||
* 展示文章推荐
|
||||
*/
|
||||
const RecommendPosts = ({ recommendPosts }) => {
|
||||
const { locale } = useGlobal()
|
||||
if (!CONFIG.ARTICLE_RELATE_POSTS || !recommendPosts || recommendPosts.length < 1) {
|
||||
if (!siteConfig('NEXT_ARTICLE_RELATE_POSTS', null, CONFIG) || !recommendPosts || recommendPosts.length < 1) {
|
||||
return <></>
|
||||
}
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@ const SideAreaLeft = props => {
|
||||
<div className='pt-2 px-2 font-sans'>
|
||||
<MenuList allowCollapse={true} {...props} />
|
||||
</div>
|
||||
{CONFIG.MENU_SEARCH && <div className='px-2 pt-2 font-sans'>
|
||||
{siteConfig('NEXT_MENU_SEARCH', null, CONFIG) && <div className='px-2 pt-2 font-sans'>
|
||||
<SearchInput {...props} />
|
||||
</div>}
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ const SideAreaRight = (props) => {
|
||||
|
||||
return (<aside id='right' className={(JSON.parse(siteConfig('LAYOUT_SIDEBAR_REVERSE')) ? 'mr-4' : 'ml-4') + ' space-y-4 hidden xl:block flex-col w-60 relative z-10'}>
|
||||
|
||||
{CONFIG.RIGHT_AD && <Card className='mb-2'>
|
||||
{siteConfig('NEXT_RIGHT_AD', null, CONFIG) && <Card className='mb-2'>
|
||||
{/* 展示广告 */}
|
||||
<ins
|
||||
className='adsbygoogle'
|
||||
@@ -48,11 +48,11 @@ const SideAreaRight = (props) => {
|
||||
<Announcement post={notice} />
|
||||
</Card>}
|
||||
|
||||
{CONFIG.RIGHT_LATEST_POSTS && <Card><LatestPostsGroup latestPosts={latestPosts} /></Card>}
|
||||
{siteConfig('NEXT_RIGHT_LATEST_POSTS', null, CONFIG) && <Card><LatestPostsGroup latestPosts={latestPosts} /></Card>}
|
||||
{slot}
|
||||
|
||||
{/* 分类 */}
|
||||
{CONFIG.RIGHT_CATEGORY_LIST && router.asPath !== '/category' && categoryOptions && (
|
||||
{siteConfig('NEXT_RIGHT_CATEGORY_LIST', null, CONFIG) && router.asPath !== '/category' && categoryOptions && (
|
||||
<Card>
|
||||
<div className='text-sm px-2 flex flex-nowrap justify-between font-light'>
|
||||
<div className='pb-2 text-gray-600 dark:text-gray-300'><i className='mr-2 fas fa-th-list' />{locale.COMMON.CATEGORY}</div>
|
||||
@@ -69,7 +69,7 @@ const SideAreaRight = (props) => {
|
||||
</Card>
|
||||
)}
|
||||
|
||||
{CONFIG.RIGHT_TAG_LIST && router.asPath !== '/tag' && tagOptions && (
|
||||
{siteConfig('NEXT_RIGHT_TAG_LIST', null, CONFIG) && router.asPath !== '/tag' && tagOptions && (
|
||||
<Card>
|
||||
<div className="text-sm pb-1 px-2 flex flex-nowrap justify-between font-light dark:text-gray-200">
|
||||
<div className="text-gray-600 dark:text-gray-200">
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import throttle from 'lodash.throttle'
|
||||
import { useCallback, useEffect } from 'react'
|
||||
import CONFIG from '../config'
|
||||
import { siteConfig } from '@/lib/config'
|
||||
|
||||
let windowTop = 0
|
||||
|
||||
@@ -13,7 +14,7 @@ let windowTop = 0
|
||||
const StickyBar = ({ children }) => {
|
||||
// 滚动页面时导航条样式调整
|
||||
const scrollTrigger = useCallback(throttle(() => {
|
||||
if (CONFIG.NAV_TYPE === 'normal') {
|
||||
if (siteConfig('NEXT_NAV_TYPE', null, CONFIG) === 'normal') {
|
||||
return
|
||||
}
|
||||
const scrollS = window.scrollY
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user