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