mirror of
https://github.com/d0zingcat/NotionNext.git
synced 2026-05-13 23:16:47 +00:00
提取公共Head
This commit is contained in:
@@ -1,73 +0,0 @@
|
||||
import { siteConfig } from '@/lib/config'
|
||||
import Head from 'next/head'
|
||||
|
||||
const CommonHead = ({ meta, children }) => {
|
||||
let url = siteConfig('PATH')?.length ? `${siteConfig('LINK')}/${siteConfig('SUB_PATH', '')}` : siteConfig('LINK')
|
||||
let image
|
||||
if (meta) {
|
||||
url = `${url}/${meta.slug}`
|
||||
image = meta.image || '/bg_image.jpg'
|
||||
}
|
||||
const title = meta?.title || siteConfig('TITLE')
|
||||
const description = meta?.description || siteConfig('DESCRIPTION')
|
||||
const type = meta?.type || 'website'
|
||||
const keywords = meta?.tags || siteConfig('KEYWORDS')
|
||||
const lang = siteConfig('LANG').replace('-', '_') // Facebook OpenGraph 要 zh_CN 這樣的格式才抓得到語言
|
||||
const category = meta?.category || siteConfig('KEYWORDS') // section 主要是像是 category 這樣的分類,Facebook 用這個來抓連結的分類
|
||||
|
||||
return (
|
||||
<Head>
|
||||
<title>{title}</title>
|
||||
<meta name="theme-color" content={siteConfig('BACKGROUND_DARK')} />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=5.0, minimum-scale=1.0" />
|
||||
<meta name="robots" content="follow, index" />
|
||||
<meta charSet="UTF-8" />
|
||||
{siteConfig('SEO_GOOGLE_SITE_VERIFICATION') && (
|
||||
<meta
|
||||
name="google-site-verification"
|
||||
content={siteConfig('SEO_GOOGLE_SITE_VERIFICATION')}
|
||||
/>
|
||||
)}
|
||||
{siteConfig('SEO_BAIDU_SITE_VERIFICATION') && (<meta name="baidu-site-verification" content={siteConfig('SEO_BAIDU_SITE_VERIFICATION')} />)}
|
||||
<meta name="keywords" content={keywords} />
|
||||
<meta name="description" content={description} />
|
||||
<meta property="og:locale" content={lang} />
|
||||
<meta property="og:title" content={title} />
|
||||
<meta property="og:description" content={description} />
|
||||
<meta property="og:url" content={url} />
|
||||
<meta property="og:image" content={image} />
|
||||
<meta property="og:site_name" content={siteConfig('TITLE')} />
|
||||
<meta property="og:type" content={type} />
|
||||
<meta name="twitter:card" content="summary_large_image" />
|
||||
<meta name="twitter:description" content={description} />
|
||||
<meta name="twitter:title" content={title} />
|
||||
|
||||
{siteConfig('COMMENT_WEBMENTION_ENABLE') && (
|
||||
<>
|
||||
<link rel="webmention" href={`https://webmention.io/${siteConfig('COMMENT_WEBMENTION_HOSTNAME')}/webmention`} />
|
||||
<link rel="pingback" href={`https://webmention.io/${siteConfig('COMMENT_WEBMENTION_HOSTNAME')}/xmlrpc`} />
|
||||
</>
|
||||
)}
|
||||
|
||||
{siteConfig('COMMENT_WEBMENTION_ENABLE') && siteConfig('COMMENT_WEBMENTION_AUTH') !== '' && (
|
||||
<link href={siteConfig('COMMENT_WEBMENTION_AUTH')} rel="me" />
|
||||
)}
|
||||
|
||||
{JSON.parse(siteConfig('ANALYTICS_BUSUANZI_ENABLE')) && <meta name="referrer" content="no-referrer-when-downgrade" />}
|
||||
{meta?.type === 'Post' && (
|
||||
<>
|
||||
<meta
|
||||
property="article:published_time"
|
||||
content={meta.publishDay}
|
||||
/>
|
||||
<meta property="article:author" content={siteConfig('AUTHOR')} />
|
||||
<meta property="article:section" content={category} />
|
||||
<meta property="article:publisher" content={siteConfig('FACEBOOK_PAGE')} />
|
||||
</>
|
||||
)}
|
||||
{children}
|
||||
</Head>
|
||||
)
|
||||
}
|
||||
|
||||
export default CommonHead
|
||||
195
components/GlobalHead.js
Normal file
195
components/GlobalHead.js
Normal file
@@ -0,0 +1,195 @@
|
||||
import { siteConfig } from '@/lib/config'
|
||||
import { useGlobal } from '@/lib/global'
|
||||
import Head from 'next/head'
|
||||
import { useRouter } from 'next/router'
|
||||
|
||||
/**
|
||||
* 页面的Head头,通常有用于SEO
|
||||
* @param {*} param0
|
||||
* @returns
|
||||
*/
|
||||
const GlobalHead = (props) => {
|
||||
const { children } = props
|
||||
let url = siteConfig('PATH')?.length ? `${siteConfig('LINK')}/${siteConfig('SUB_PATH', '')}` : siteConfig('LINK')
|
||||
let image
|
||||
const meta = getSEOMeta(props, useRouter(), useGlobal())
|
||||
if (meta) {
|
||||
url = `${url}/${meta.slug}`
|
||||
image = meta.image || '/bg_image.jpg'
|
||||
}
|
||||
const title = meta?.title || siteConfig('TITLE')
|
||||
const description = meta?.description || siteConfig('DESCRIPTION')
|
||||
const type = meta?.type || 'website'
|
||||
const keywords = meta?.tags || siteConfig('KEYWORDS')
|
||||
const lang = siteConfig('LANG').replace('-', '_') // Facebook OpenGraph 要 zh_CN 這樣的格式才抓得到語言
|
||||
const category = meta?.category || siteConfig('KEYWORDS') // section 主要是像是 category 這樣的分類,Facebook 用這個來抓連結的分類
|
||||
|
||||
return (
|
||||
<Head>
|
||||
<title>{title}</title>
|
||||
<meta name="theme-color" content={siteConfig('BACKGROUND_DARK')} />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=5.0, minimum-scale=1.0" />
|
||||
<meta name="robots" content="follow, index" />
|
||||
<meta charSet="UTF-8" />
|
||||
{siteConfig('SEO_GOOGLE_SITE_VERIFICATION') && (
|
||||
<meta
|
||||
name="google-site-verification"
|
||||
content={siteConfig('SEO_GOOGLE_SITE_VERIFICATION')}
|
||||
/>
|
||||
)}
|
||||
{siteConfig('SEO_BAIDU_SITE_VERIFICATION') && (<meta name="baidu-site-verification" content={siteConfig('SEO_BAIDU_SITE_VERIFICATION')} />)}
|
||||
<meta name="keywords" content={keywords} />
|
||||
<meta name="description" content={description} />
|
||||
<meta property="og:locale" content={lang} />
|
||||
<meta property="og:title" content={title} />
|
||||
<meta property="og:description" content={description} />
|
||||
<meta property="og:url" content={url} />
|
||||
<meta property="og:image" content={image} />
|
||||
<meta property="og:site_name" content={siteConfig('TITLE')} />
|
||||
<meta property="og:type" content={type} />
|
||||
<meta name="twitter:card" content="summary_large_image" />
|
||||
<meta name="twitter:description" content={description} />
|
||||
<meta name="twitter:title" content={title} />
|
||||
|
||||
{siteConfig('COMMENT_WEBMENTION_ENABLE') && (
|
||||
<>
|
||||
<link rel="webmention" href={`https://webmention.io/${siteConfig('COMMENT_WEBMENTION_HOSTNAME')}/webmention`} />
|
||||
<link rel="pingback" href={`https://webmention.io/${siteConfig('COMMENT_WEBMENTION_HOSTNAME')}/xmlrpc`} />
|
||||
</>
|
||||
)}
|
||||
|
||||
{siteConfig('COMMENT_WEBMENTION_ENABLE') && siteConfig('COMMENT_WEBMENTION_AUTH') !== '' && (
|
||||
<link href={siteConfig('COMMENT_WEBMENTION_AUTH')} rel="me" />
|
||||
)}
|
||||
|
||||
{JSON.parse(siteConfig('ANALYTICS_BUSUANZI_ENABLE')) && <meta name="referrer" content="no-referrer-when-downgrade" />}
|
||||
{meta?.type === 'Post' && (
|
||||
<>
|
||||
<meta
|
||||
property="article:published_time"
|
||||
content={meta.publishDay}
|
||||
/>
|
||||
<meta property="article:author" content={siteConfig('AUTHOR')} />
|
||||
<meta property="article:section" content={category} />
|
||||
<meta property="article:publisher" content={siteConfig('FACEBOOK_PAGE')} />
|
||||
</>
|
||||
)}
|
||||
{children}
|
||||
</Head>
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取SEO信息
|
||||
* @param {*} props
|
||||
* @param {*} router
|
||||
*/
|
||||
const getSEOMeta = (props, router, global) => {
|
||||
console.log(props, router)
|
||||
const { locale } = global
|
||||
const { post, tag, category, page } = props
|
||||
const keyword = router?.query?.s
|
||||
|
||||
switch (router.route) {
|
||||
case '/':
|
||||
return {
|
||||
title: `${siteConfig('TITLE')} | ${siteConfig('DESCRIPTION')}`,
|
||||
description: siteConfig('DESCRIPTION'),
|
||||
image: siteConfig('HOME_BANNER_IMAGE'),
|
||||
slug: '',
|
||||
type: 'website'
|
||||
}
|
||||
case '/archive':
|
||||
return {
|
||||
title: `${locale.NAV.ARCHIVE} | ${siteConfig('TITLE')}`,
|
||||
description: siteConfig('DESCRIPTION'),
|
||||
image: siteConfig('HOME_BANNER_IMAGE'),
|
||||
slug: 'archive',
|
||||
type: 'website'
|
||||
}
|
||||
case '/page/[page]':
|
||||
return {
|
||||
title: `${page} | Page | ${siteConfig('TITLE')}`,
|
||||
description: siteConfig('DESCRIPTION'),
|
||||
image: siteConfig('HOME_BANNER_IMAGE'),
|
||||
slug: 'page/' + page,
|
||||
type: 'website'
|
||||
}
|
||||
case '/category/[category]':
|
||||
return {
|
||||
title: `${category} | ${locale.COMMON.CATEGORY} | ${
|
||||
siteConfig('TITLE') || ''
|
||||
}`,
|
||||
description: siteConfig('DESCRIPTION'),
|
||||
slug: 'category/' + category,
|
||||
image: siteConfig('HOME_BANNER_IMAGE'),
|
||||
type: 'website'
|
||||
}
|
||||
case '/category/[category]/page/[page]':
|
||||
return {
|
||||
title: `${category} | ${locale.COMMON.CATEGORY} | ${
|
||||
siteConfig('TITLE') || ''
|
||||
}`,
|
||||
description: siteConfig('DESCRIPTION'),
|
||||
slug: 'category/' + category,
|
||||
image: siteConfig('HOME_BANNER_IMAGE'),
|
||||
type: 'website'
|
||||
}
|
||||
case '/tag/[tag]':
|
||||
case '/tag/[tag]/page/[page]':
|
||||
return {
|
||||
title: `${tag} | ${locale.COMMON.TAGS} | ${siteConfig('TITLE')}`,
|
||||
description: siteConfig('DESCRIPTION'),
|
||||
image: siteConfig('HOME_BANNER_IMAGE'),
|
||||
slug: 'tag/' + tag,
|
||||
type: 'website'
|
||||
}
|
||||
case '/search':
|
||||
return {
|
||||
title: `${keyword || ''}${keyword ? ' | ' : ''}${locale.NAV.SEARCH} | ${siteConfig('TITLE')}`,
|
||||
description: siteConfig('DESCRIPTION'),
|
||||
image: siteConfig('HOME_BANNER_IMAGE'),
|
||||
slug: 'search',
|
||||
type: 'website'
|
||||
}
|
||||
case '/search/[keyword]':
|
||||
case '/search/[keyword]/page/[page]':
|
||||
return {
|
||||
title: `${keyword || ''}${keyword ? ' | ' : ''}${locale.NAV.SEARCH} | ${siteConfig('TITLE')}`,
|
||||
description: siteConfig('TITLE'),
|
||||
image: siteConfig('HOME_BANNER_IMAGE'),
|
||||
slug: 'search/' + (keyword || ''),
|
||||
type: 'website'
|
||||
}
|
||||
case '/404':
|
||||
return { title: `${siteConfig('TITLE')} | 页面找不到啦`, image: siteConfig('HOME_BANNER_IMAGE') }
|
||||
case '/tag':
|
||||
return {
|
||||
title: `${locale.COMMON.TAGS} | ${siteConfig('TITLE')}`,
|
||||
description: siteConfig('DESCRIPTION'),
|
||||
image: siteConfig('HOME_BANNER_IMAGE'),
|
||||
slug: 'tag',
|
||||
type: 'website'
|
||||
}
|
||||
case '/category':
|
||||
return {
|
||||
title: `${locale.COMMON.CATEGORY} | ${siteConfig('TITLE')}`,
|
||||
description: siteConfig('DESCRIPTION'),
|
||||
image: siteConfig('HOME_BANNER_IMAGE'),
|
||||
slug: 'category',
|
||||
type: 'website'
|
||||
}
|
||||
default:
|
||||
return {
|
||||
title: post ? `${post?.title} | ${siteConfig('TITLE')}` : `${siteConfig('TITLE')} | loading`,
|
||||
description: post?.summary,
|
||||
type: post?.type,
|
||||
slug: post?.slug,
|
||||
image: post?.pageCoverThumbnail || siteConfig('HOME_BANNER_IMAGE'),
|
||||
category: post?.category?.[0],
|
||||
tags: post?.tags
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export default GlobalHead
|
||||
@@ -13,12 +13,12 @@ const GlobalContext = createContext()
|
||||
*/
|
||||
export function GlobalContextProvider(props) {
|
||||
const { post, children, siteInfo, categoryOptions, tagOptions, NOTION_CONFIG } = props
|
||||
const router = useRouter()
|
||||
const [lang, updateLang] = useState(NOTION_CONFIG?.LANG || LANG) // 默认语言
|
||||
const [locale, updateLocale] = useState(generateLocaleDict(NOTION_CONFIG?.LANG || LANG)) // 默认语言
|
||||
const [theme, setTheme] = useState(NOTION_CONFIG?.THEME || THEME) // 默认博客主题
|
||||
const [isDarkMode, updateDarkMode] = useState(NOTION_CONFIG?.APPEARANCE || APPEARANCE === 'dark') // 默认深色模式
|
||||
const [onLoading, setOnLoading] = useState(false) // 抓取文章数据
|
||||
const router = useRouter()
|
||||
|
||||
// 是否全屏
|
||||
const fullWidth = post?.fullWidth ?? false
|
||||
|
||||
@@ -9,13 +9,8 @@ import { siteConfig } from '@/lib/config'
|
||||
* @returns
|
||||
*/
|
||||
const NoFound = props => {
|
||||
const meta = { title: `${siteConfig('TITLE')} | 页面找不到啦`, image: siteConfig('HOME_BANNER_IMAGE') }
|
||||
|
||||
props = { ...props, meta }
|
||||
|
||||
// 根据页面路径加载不同Layout文件
|
||||
const Layout = getLayoutByTheme({ theme: siteConfig('THEME'), router: useRouter() })
|
||||
|
||||
return <Layout {...props} />
|
||||
}
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ import { siteConfig } from '@/lib/config'
|
||||
* @returns
|
||||
*/
|
||||
const Slug = props => {
|
||||
const { post, siteInfo } = props
|
||||
const { post } = props
|
||||
const router = useRouter()
|
||||
|
||||
// 文章锁🔐
|
||||
@@ -66,16 +66,7 @@ const Slug = props => {
|
||||
}
|
||||
}, [post])
|
||||
|
||||
const meta = {
|
||||
title: post ? `${post?.title} | ${siteConfig('TITLE')}` : `${siteConfig('TITLE')} | loading`,
|
||||
description: post?.summary,
|
||||
type: post?.type,
|
||||
slug: post?.slug,
|
||||
image: post?.pageCoverThumbnail || (siteInfo?.pageCover || BLOG.HOME_BANNER_IMAGE),
|
||||
category: post?.category?.[0],
|
||||
tags: post?.tags
|
||||
}
|
||||
props = { ...props, lock, meta, setLock, validPassword }
|
||||
props = { ...props, lock, setLock, validPassword }
|
||||
// 根据页面路径加载不同Layout文件
|
||||
const Layout = getLayoutByTheme({ theme: siteConfig('THEME'), router: useRouter() })
|
||||
return <Layout {...props} />
|
||||
|
||||
@@ -18,6 +18,7 @@ import useAdjustStyle from '@/hooks/useAdjustStyle'
|
||||
// 各种扩展插件 这个要阻塞引入
|
||||
import ExternalPlugins from '@/components/ExternalPlugins'
|
||||
import { THEME } from '@/blog.config'
|
||||
import GlobalHead from '@/components/GlobalHead'
|
||||
|
||||
const MyApp = ({ Component, pageProps }) => {
|
||||
// 一些可能出现 bug 的样式,可以统一放入该钩子进行调整
|
||||
@@ -28,6 +29,7 @@ const MyApp = ({ Component, pageProps }) => {
|
||||
return getQueryParam(route.asPath, 'theme') || THEME
|
||||
}, [route])
|
||||
|
||||
// 整体布局
|
||||
const GLayout = useCallback(
|
||||
props => {
|
||||
// 根据页面路径加载不同Layout文件
|
||||
@@ -40,6 +42,7 @@ const MyApp = ({ Component, pageProps }) => {
|
||||
return (
|
||||
<GlobalContextProvider {...pageProps}>
|
||||
<GLayout {...pageProps}>
|
||||
<GlobalHead {...pageProps}/>
|
||||
<Component {...pageProps} />
|
||||
</GLayout>
|
||||
<ExternalPlugins {...pageProps} />
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import { getGlobalData } from '@/lib/notion/getNotionData'
|
||||
import { useEffect } from 'react'
|
||||
import { useGlobal } from '@/lib/global'
|
||||
import BLOG from '@/blog.config'
|
||||
import { useRouter } from 'next/router'
|
||||
import { getLayoutByTheme } from '@/themes/theme'
|
||||
@@ -9,9 +8,6 @@ import { formatDateFmt } from '@/lib/formatDate'
|
||||
import { siteConfig } from '@/lib/config'
|
||||
|
||||
const ArchiveIndex = props => {
|
||||
const { siteInfo } = props
|
||||
const { locale } = useGlobal()
|
||||
|
||||
// 根据页面路径加载不同Layout文件
|
||||
const Layout = getLayoutByTheme({ theme: siteConfig('THEME'), router: useRouter() })
|
||||
|
||||
@@ -29,16 +25,6 @@ const ArchiveIndex = props => {
|
||||
}
|
||||
}, [])
|
||||
|
||||
const meta = {
|
||||
title: `${locale.NAV.ARCHIVE} | ${siteConfig('TITLE')}`,
|
||||
description: siteConfig('DESCRIPTION'),
|
||||
image: siteInfo?.pageCover,
|
||||
slug: 'archive',
|
||||
type: 'website'
|
||||
}
|
||||
|
||||
props = { ...props, meta }
|
||||
|
||||
return <Layout {...props} />
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import { getGlobalData } from '@/lib/notion/getNotionData'
|
||||
import React from 'react'
|
||||
import { useGlobal } from '@/lib/global'
|
||||
import BLOG from '@/blog.config'
|
||||
import { useRouter } from 'next/router'
|
||||
import { getLayoutByTheme } from '@/themes/theme'
|
||||
@@ -12,24 +11,9 @@ import { siteConfig } from '@/lib/config'
|
||||
* @returns
|
||||
*/
|
||||
export default function Category(props) {
|
||||
const { siteInfo } = props
|
||||
const { locale } = useGlobal()
|
||||
|
||||
// 根据页面路径加载不同Layout文件
|
||||
const Layout = getLayoutByTheme({ theme: siteConfig('THEME'), router: useRouter() })
|
||||
|
||||
const meta = {
|
||||
title: `${props.category} | ${locale.COMMON.CATEGORY} | ${
|
||||
siteConfig('TITLE') || ''
|
||||
}`,
|
||||
description: siteConfig('DESCRIPTION'),
|
||||
slug: 'category/' + props.category,
|
||||
image: siteInfo?.pageCover,
|
||||
type: 'website'
|
||||
}
|
||||
|
||||
props = { ...props, meta }
|
||||
|
||||
return <Layout {...props} />
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import { getGlobalData } from '@/lib/notion/getNotionData'
|
||||
import React from 'react'
|
||||
import { useGlobal } from '@/lib/global'
|
||||
import BLOG from '@/blog.config'
|
||||
import { useRouter } from 'next/router'
|
||||
import { getLayoutByTheme } from '@/themes/theme'
|
||||
@@ -13,23 +12,9 @@ import { siteConfig } from '@/lib/config'
|
||||
*/
|
||||
|
||||
export default function Category(props) {
|
||||
const { siteInfo } = props
|
||||
const { locale } = useGlobal()
|
||||
// 根据页面路径加载不同Layout文件
|
||||
const Layout = getLayoutByTheme({ theme: siteConfig('THEME'), router: useRouter() })
|
||||
|
||||
const meta = {
|
||||
title: `${props.category} | ${locale.COMMON.CATEGORY} | ${
|
||||
siteConfig('TITLE') || ''
|
||||
}`,
|
||||
description: siteConfig('DESCRIPTION'),
|
||||
slug: 'category/' + props.category,
|
||||
image: siteInfo?.pageCover,
|
||||
type: 'website'
|
||||
}
|
||||
|
||||
props = { ...props, meta }
|
||||
|
||||
return <Layout {...props} />
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import { getGlobalData } from '@/lib/notion/getNotionData'
|
||||
import React from 'react'
|
||||
import { useGlobal } from '@/lib/global'
|
||||
import BLOG from '@/blog.config'
|
||||
import { useRouter } from 'next/router'
|
||||
import { getLayoutByTheme } from '@/themes/theme'
|
||||
@@ -12,21 +11,9 @@ import { siteConfig } from '@/lib/config'
|
||||
* @returns
|
||||
*/
|
||||
export default function Category(props) {
|
||||
const { locale } = useGlobal()
|
||||
const { siteInfo } = props
|
||||
|
||||
// 根据页面路径加载不同Layout文件
|
||||
const Layout = getLayoutByTheme({ theme: siteConfig('THEME'), router: useRouter() })
|
||||
|
||||
const meta = {
|
||||
title: `${locale.COMMON.CATEGORY} | ${siteConfig('TITLE')}`,
|
||||
description: siteConfig('DESCRIPTION'),
|
||||
image: siteInfo?.pageCover,
|
||||
slug: 'category',
|
||||
type: 'website'
|
||||
}
|
||||
props = { ...props, meta }
|
||||
|
||||
return <Layout {...props} />
|
||||
}
|
||||
|
||||
|
||||
@@ -15,15 +15,7 @@ import { useRouter } from 'next/router'
|
||||
const Index = props => {
|
||||
// 根据页面路径加载不同Layout文件
|
||||
const Layout = getLayoutByTheme({ theme: siteConfig('THEME'), router: useRouter() })
|
||||
|
||||
const meta = {
|
||||
title: `${siteConfig('TITLE')} | ${siteConfig('DESCRIPTION')}`,
|
||||
description: siteConfig('DESCRIPTION'),
|
||||
image: siteConfig('HOME_BANNER_IMAGE'),
|
||||
slug: '',
|
||||
type: 'website'
|
||||
}
|
||||
return <Layout meta={meta} {...props} />
|
||||
return <Layout {...props} />
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -11,21 +11,9 @@ import { siteConfig } from '@/lib/config'
|
||||
* @returns
|
||||
*/
|
||||
const Page = props => {
|
||||
const { siteInfo } = props
|
||||
|
||||
// 根据页面路径加载不同Layout文件
|
||||
const Layout = getLayoutByTheme({ theme: siteConfig('THEME'), router: useRouter() })
|
||||
|
||||
const meta = {
|
||||
title: `${props?.page} | Page | ${siteConfig('TITLE')}`,
|
||||
description: siteConfig('DESCRIPTION'),
|
||||
image: siteInfo?.pageCover,
|
||||
slug: 'page/' + props.page,
|
||||
type: 'website'
|
||||
}
|
||||
|
||||
props = { ...props, meta }
|
||||
|
||||
return <Layout {...props} />
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import { getGlobalData } from '@/lib/notion/getNotionData'
|
||||
import { useGlobal } from '@/lib/global'
|
||||
import { getDataFromCache } from '@/lib/cache/cache_manager'
|
||||
import BLOG from '@/blog.config'
|
||||
import { useRouter } from 'next/router'
|
||||
@@ -7,22 +6,9 @@ import { getLayoutByTheme } from '@/themes/theme'
|
||||
import { siteConfig } from '@/lib/config'
|
||||
|
||||
const Index = props => {
|
||||
const { keyword, siteInfo } = props
|
||||
const { locale } = useGlobal()
|
||||
|
||||
// 根据页面路径加载不同Layout文件
|
||||
const Layout = getLayoutByTheme({ theme: siteConfig('THEME'), router: useRouter() })
|
||||
|
||||
const meta = {
|
||||
title: `${keyword || ''}${keyword ? ' | ' : ''}${locale.NAV.SEARCH} | ${siteConfig('TITLE')}`,
|
||||
description: siteConfig('TITLE'),
|
||||
image: siteInfo?.pageCover,
|
||||
slug: 'search/' + (keyword || ''),
|
||||
type: 'website'
|
||||
}
|
||||
|
||||
props = { ...props, meta }
|
||||
|
||||
return <Layout {...props} />
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import { getGlobalData } from '@/lib/notion/getNotionData'
|
||||
import { useGlobal } from '@/lib/global'
|
||||
import { getDataFromCache } from '@/lib/cache/cache_manager'
|
||||
import BLOG from '@/blog.config'
|
||||
import { useRouter } from 'next/router'
|
||||
@@ -7,21 +6,10 @@ import { getLayoutByTheme } from '@/themes/theme'
|
||||
import { siteConfig } from '@/lib/config'
|
||||
|
||||
const Index = props => {
|
||||
const { keyword, siteInfo } = props
|
||||
const { locale } = useGlobal()
|
||||
|
||||
const { keyword } = props
|
||||
// 根据页面路径加载不同Layout文件
|
||||
const Layout = getLayoutByTheme({ theme: siteConfig('THEME'), router: useRouter() })
|
||||
|
||||
const meta = {
|
||||
title: `${keyword || ''}${keyword ? ' | ' : ''}${locale.NAV.SEARCH} | ${siteConfig('TITLE')}`,
|
||||
description: siteConfig('TITLE'),
|
||||
image: siteInfo?.pageCover,
|
||||
slug: 'search/' + (keyword || ''),
|
||||
type: 'website'
|
||||
}
|
||||
|
||||
props = { ...props, meta, currentSearch: keyword }
|
||||
props = { ...props, currentSearch: keyword }
|
||||
|
||||
return <Layout {...props} />
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import { getGlobalData } from '@/lib/notion/getNotionData'
|
||||
import { useGlobal } from '@/lib/global'
|
||||
import { useRouter } from 'next/router'
|
||||
import BLOG from '@/blog.config'
|
||||
import { getLayoutByTheme } from '@/themes/theme'
|
||||
@@ -11,14 +10,13 @@ import { siteConfig } from '@/lib/config'
|
||||
* @returns
|
||||
*/
|
||||
const Search = props => {
|
||||
const { posts, siteInfo } = props
|
||||
const { locale } = useGlobal()
|
||||
const { posts } = props
|
||||
|
||||
// 根据页面路径加载不同Layout文件
|
||||
const Layout = getLayoutByTheme({ theme: siteConfig('THEME'), router: useRouter() })
|
||||
|
||||
const router = useRouter()
|
||||
const keyword = getSearchKey(router)
|
||||
const keyword = router?.query?.s
|
||||
|
||||
let filteredPosts
|
||||
// 静态过滤
|
||||
@@ -34,15 +32,7 @@ const Search = props => {
|
||||
filteredPosts = []
|
||||
}
|
||||
|
||||
const meta = {
|
||||
title: `${keyword || ''}${keyword ? ' | ' : ''}${locale.NAV.SEARCH} | ${siteConfig('TITLE')}`,
|
||||
description: siteConfig('DESCRIPTION'),
|
||||
image: siteInfo?.pageCover,
|
||||
slug: 'search',
|
||||
type: 'website'
|
||||
}
|
||||
|
||||
props = { ...props, meta, posts: filteredPosts }
|
||||
props = { ...props, posts: filteredPosts }
|
||||
|
||||
return <Layout {...props} />
|
||||
}
|
||||
@@ -63,11 +53,4 @@ export async function getStaticProps() {
|
||||
}
|
||||
}
|
||||
|
||||
function getSearchKey(router) {
|
||||
if (router.query && router.query.s) {
|
||||
return router.query.s
|
||||
}
|
||||
return null
|
||||
}
|
||||
|
||||
export default Search
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import { useGlobal } from '@/lib/global'
|
||||
import { getGlobalData } from '@/lib/notion/getNotionData'
|
||||
import BLOG from '@/blog.config'
|
||||
import { useRouter } from 'next/router'
|
||||
@@ -11,21 +10,9 @@ import { siteConfig } from '@/lib/config'
|
||||
* @returns
|
||||
*/
|
||||
const Tag = props => {
|
||||
const { locale } = useGlobal()
|
||||
const { tag, siteInfo } = props
|
||||
|
||||
// 根据页面路径加载不同Layout文件
|
||||
const Layout = getLayoutByTheme({ theme: siteConfig('THEME'), router: useRouter() })
|
||||
|
||||
const meta = {
|
||||
title: `${tag} | ${locale.COMMON.TAGS} | ${siteConfig('TITLE')}`,
|
||||
description: siteConfig('DESCRIPTION'),
|
||||
image: siteInfo?.pageCover,
|
||||
slug: 'tag/' + tag,
|
||||
type: 'website'
|
||||
}
|
||||
props = { ...props, meta }
|
||||
|
||||
return <Layout {...props} />
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import { useGlobal } from '@/lib/global'
|
||||
import { getGlobalData } from '@/lib/notion/getNotionData'
|
||||
import BLOG from '@/blog.config'
|
||||
import { useRouter } from 'next/router'
|
||||
@@ -6,21 +5,8 @@ import { getLayoutByTheme } from '@/themes/theme'
|
||||
import { siteConfig } from '@/lib/config'
|
||||
|
||||
const Tag = props => {
|
||||
const { locale } = useGlobal()
|
||||
const { tag, siteInfo } = props
|
||||
|
||||
// 根据页面路径加载不同Layout文件
|
||||
const Layout = getLayoutByTheme({ theme: siteConfig('THEME'), router: useRouter() })
|
||||
|
||||
const meta = {
|
||||
title: `${tag} | ${locale.COMMON.TAGS} | ${siteConfig('TITLE')}`,
|
||||
description: siteConfig('DESCRIPTION'),
|
||||
image: siteInfo?.pageCover,
|
||||
slug: 'tag/' + tag,
|
||||
type: 'website'
|
||||
}
|
||||
props = { ...props, meta }
|
||||
|
||||
return <Layout {...props} />
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import { getGlobalData } from '@/lib/notion/getNotionData'
|
||||
import { useGlobal } from '@/lib/global'
|
||||
import BLOG from '@/blog.config'
|
||||
import { useRouter } from 'next/router'
|
||||
import { getLayoutByTheme } from '@/themes/theme'
|
||||
@@ -11,21 +10,8 @@ import { siteConfig } from '@/lib/config'
|
||||
* @returns
|
||||
*/
|
||||
const TagIndex = props => {
|
||||
const { locale } = useGlobal()
|
||||
const { siteInfo } = props
|
||||
|
||||
// 根据页面路径加载不同Layout文件
|
||||
const Layout = getLayoutByTheme({ theme: siteConfig('THEME'), router: useRouter() })
|
||||
|
||||
const meta = {
|
||||
title: `${locale.COMMON.TAGS} | ${siteConfig('TITLE')}`,
|
||||
description: siteConfig('DESCRIPTION'),
|
||||
image: siteInfo?.pageCover,
|
||||
slug: 'tag',
|
||||
type: 'website'
|
||||
}
|
||||
props = { ...props, meta }
|
||||
|
||||
return <Layout {...props} />
|
||||
}
|
||||
|
||||
|
||||
@@ -25,7 +25,6 @@ import TagItem from './components/TagItem'
|
||||
import { useRouter } from 'next/router'
|
||||
import { Transition } from '@headlessui/react'
|
||||
import { Style } from './style'
|
||||
import CommonHead from '@/components/CommonHead'
|
||||
import { siteConfig } from '@/lib/config'
|
||||
|
||||
/**
|
||||
@@ -36,7 +35,7 @@ import { siteConfig } from '@/lib/config'
|
||||
* @constructor
|
||||
*/
|
||||
const LayoutBase = props => {
|
||||
const { children, meta } = props
|
||||
const { children } = props
|
||||
const { onLoading, fullWidth } = useGlobal()
|
||||
const router = useRouter()
|
||||
const { category, tag } = props
|
||||
@@ -65,9 +64,6 @@ const LayoutBase = props => {
|
||||
return (
|
||||
<div id='theme-example' className='dark:text-gray-300 bg-white dark:bg-black'>
|
||||
|
||||
{/* SEO信息 */}
|
||||
<CommonHead meta={meta}/>
|
||||
|
||||
<Style/>
|
||||
|
||||
{/* 页头 */}
|
||||
|
||||
@@ -19,7 +19,6 @@ import dynamic from 'next/dynamic'
|
||||
import { AdSlot } from '@/components/GoogleAdsense'
|
||||
import { Style } from './style'
|
||||
import replaceSearchResult from '@/components/Mark'
|
||||
import CommonHead from '@/components/CommonHead'
|
||||
import { siteConfig } from '@/lib/config'
|
||||
import WWAds from '@/components/WWAds'
|
||||
|
||||
@@ -44,7 +43,7 @@ export const useFukasawaGlobal = () => useContext(ThemeGlobalFukasawa)
|
||||
* @constructor
|
||||
*/
|
||||
const LayoutBase = (props) => {
|
||||
const { children, headerSlot, meta } = props
|
||||
const { children, headerSlot } = props
|
||||
const leftAreaSlot = <Live2D />
|
||||
const { onLoading, fullWidth } = useGlobal()
|
||||
|
||||
@@ -52,8 +51,6 @@ const LayoutBase = (props) => {
|
||||
<ThemeGlobalFukasawa.Provider value={{}}>
|
||||
|
||||
<div id='theme-fukasawa'>
|
||||
{/* SEO信息 */}
|
||||
<CommonHead meta={meta}/>
|
||||
<Style/>
|
||||
|
||||
<TopNav {...props} />
|
||||
|
||||
@@ -29,7 +29,6 @@ import NotionPage from '@/components/NotionPage'
|
||||
import { ArticleLock } from './components/ArticleLock'
|
||||
import { Transition } from '@headlessui/react'
|
||||
import { Style } from './style'
|
||||
import CommonHead from '@/components/CommonHead'
|
||||
import BlogArchiveItem from './components/BlogArchiveItem'
|
||||
import Link from 'next/link'
|
||||
import dynamic from 'next/dynamic'
|
||||
@@ -47,7 +46,7 @@ export const useGitBookGlobal = () => useContext(ThemeGlobalGitbook)
|
||||
* @constructor
|
||||
*/
|
||||
const LayoutBase = (props) => {
|
||||
const { children, post, allNavPages, slotLeft, slotRight, slotTop, meta } = props
|
||||
const { children, post, allNavPages, slotLeft, slotRight, slotTop } = props
|
||||
const { onLoading, fullWidth } = useGlobal()
|
||||
const router = useRouter()
|
||||
const [tocVisible, changeTocVisible] = useState(false)
|
||||
@@ -62,7 +61,6 @@ const LayoutBase = (props) => {
|
||||
|
||||
return (
|
||||
<ThemeGlobalGitbook.Provider value={{ tocVisible, changeTocVisible, filteredNavPages, setFilteredNavPages, allNavPages, pageNavVisible, changePageNavVisible }}>
|
||||
<CommonHead meta={meta}/>
|
||||
<Style/>
|
||||
|
||||
<div id='theme-gitbook' className='bg-white dark:bg-hexo-black-gray w-full h-full min-h-screen justify-center dark:text-gray-300'>
|
||||
|
||||
@@ -7,7 +7,6 @@
|
||||
*/
|
||||
|
||||
import CONFIG from './config'
|
||||
import CommonHead from '@/components/CommonHead'
|
||||
import { useEffect, useState } from 'react'
|
||||
import Footer from './components/Footer'
|
||||
import SideRight from './components/SideRight'
|
||||
@@ -51,8 +50,7 @@ const LayoutBase = props => {
|
||||
const {
|
||||
children,
|
||||
slotTop,
|
||||
className,
|
||||
meta
|
||||
className
|
||||
} = props
|
||||
|
||||
// 全屏模式下的最大宽度
|
||||
@@ -90,8 +88,7 @@ const LayoutBase = props => {
|
||||
id="theme-heo"
|
||||
className="bg-[#f7f9fe] dark:bg-[#18171d] h-full min-h-screen flex flex-col"
|
||||
>
|
||||
{/* SEO信息 */}
|
||||
<CommonHead meta={meta} />
|
||||
|
||||
<Style />
|
||||
|
||||
{/* 顶部嵌入 导航栏,首页放hero,文章页放文章详情 */}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import CONFIG from './config'
|
||||
import CommonHead from '@/components/CommonHead'
|
||||
import { createContext, useContext, useEffect, useRef } from 'react'
|
||||
import Footer from './components/Footer'
|
||||
import SideRight from './components/SideRight'
|
||||
@@ -45,7 +44,7 @@ export const useHexoGlobal = () => useContext(ThemeGlobalHexo)
|
||||
* @constructor
|
||||
*/
|
||||
const LayoutBase = props => {
|
||||
const { post, children, slotTop, meta, className } = props
|
||||
const { post, children, slotTop, className } = props
|
||||
const { onLoading, fullWidth } = useGlobal()
|
||||
|
||||
const router = useRouter()
|
||||
@@ -75,8 +74,6 @@ const LayoutBase = props => {
|
||||
return (
|
||||
<ThemeGlobalHexo.Provider value={{ searchModal }}>
|
||||
<div id='theme-hexo'>
|
||||
{/* 网页SEO */}
|
||||
<CommonHead meta={meta}/>
|
||||
<Style/>
|
||||
|
||||
{/* 顶部导航 */}
|
||||
|
||||
@@ -15,7 +15,6 @@ import Features from './components/Features'
|
||||
import FeaturesBlocks from './components/FeaturesBlocks'
|
||||
import Testimonials from './components/Testimonials'
|
||||
import Newsletter from './components/Newsletter'
|
||||
import CommonHead from '@/components/CommonHead'
|
||||
import { useRouter } from 'next/router'
|
||||
import CONFIG from './config'
|
||||
import Loading from '@/components/Loading'
|
||||
@@ -30,13 +29,10 @@ import { siteConfig } from '@/lib/config'
|
||||
* @returns
|
||||
*/
|
||||
const LayoutBase = (props) => {
|
||||
const { meta, siteInfo, children } = props
|
||||
const { children } = props
|
||||
|
||||
return <div id='theme-landing' className="overflow-hidden flex flex-col justify-between bg-white">
|
||||
|
||||
{/* 网页SEO */}
|
||||
<CommonHead meta={meta} siteInfo={siteInfo} />
|
||||
|
||||
{/* 顶部导航栏 */}
|
||||
<Header />
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import CONFIG from './config'
|
||||
import CommonHead from '@/components/CommonHead'
|
||||
import TopNav from './components/TopNav'
|
||||
import Live2D from '@/components/Live2D'
|
||||
import { useGlobal } from '@/lib/global'
|
||||
@@ -40,7 +39,7 @@ import { siteConfig } from '@/lib/config'
|
||||
* @constructor
|
||||
*/
|
||||
const LayoutBase = props => {
|
||||
const { children, meta, siteInfo, post } = props
|
||||
const { children, post } = props
|
||||
const { onLoading, fullWidth } = useGlobal()
|
||||
const router = useRouter()
|
||||
const containerSlot = router.route === '/' ? <Announcement {...props} /> : <BlogListBar {...props} />
|
||||
@@ -52,8 +51,7 @@ const LayoutBase = props => {
|
||||
|
||||
return (
|
||||
<div id='theme-matery' className="min-h-screen flex flex-col justify-between bg-hexo-background-gray dark:bg-black w-full">
|
||||
{/* SEO相关 */}
|
||||
<CommonHead meta={meta} siteInfo={siteInfo} />
|
||||
|
||||
<Style/>
|
||||
|
||||
{/* 顶部导航栏 */}
|
||||
|
||||
@@ -33,7 +33,6 @@ import { Transition } from '@headlessui/react'
|
||||
import { Style } from './style'
|
||||
import replaceSearchResult from '@/components/Mark'
|
||||
import ArticleInfo from './components/ArticleInfo'
|
||||
import CommonHead from '@/components/CommonHead'
|
||||
import { siteConfig } from '@/lib/config'
|
||||
|
||||
// 主题全局状态
|
||||
@@ -47,7 +46,7 @@ export const useMediumGlobal = () => useContext(ThemeGlobalMedium)
|
||||
* @constructor
|
||||
*/
|
||||
const LayoutBase = props => {
|
||||
const { children, showInfoCard = true, slotRight, notice, meta } = props
|
||||
const { children, showInfoCard = true, slotRight, notice } = props
|
||||
const { locale } = useGlobal()
|
||||
const router = useRouter()
|
||||
const [tocVisible, changeTocVisible] = useState(false)
|
||||
@@ -57,8 +56,6 @@ const LayoutBase = props => {
|
||||
|
||||
return (
|
||||
<ThemeGlobalMedium.Provider value={{ tocVisible, changeTocVisible }}>
|
||||
{/* SEO相关 */}
|
||||
<CommonHead meta={meta} />
|
||||
{/* CSS样式 */}
|
||||
<Style />
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ const BlogPostItem = (props) => {
|
||||
<div id='uncategory' className='category text-lg pt-9 pb-4 first:pt-4 font-bold select-none flex justify-between font-sans text-neutral-800 dark:text-neutral-400 p-2' key='uncategory'>
|
||||
<span><i className={`text-base mr-2 ${group?.icon ? group?.icon : 'fas fa-hashtag'}`} />未分类</span>
|
||||
</div>
|
||||
<div class='card-list grid gap-4 sm:grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 2xl:grid-cols-5'>
|
||||
<div className='card-list grid gap-4 sm:grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 2xl:grid-cols-5'>
|
||||
{group?.items?.map(post => (
|
||||
<BlogPostCard key={post.id} className='card' post={post} />
|
||||
))}
|
||||
|
||||
@@ -56,7 +56,6 @@ export const MenuItem = ({ link }) => {
|
||||
// #号加标题 快速跳转到指定锚点
|
||||
const sIsAnchor = sLink?.to === '#'
|
||||
const sUrl = sIsAnchor ? `#${sLink.name}` : sLink.to
|
||||
console.log('slink', sLink, sUrl, sIsAnchor, sUrl)
|
||||
return <div key={index} className='nav-submenu'>
|
||||
<Link href={sUrl}>
|
||||
<span className='dark:text-neutral-400 text-gray-500 hover:text-black dark:hover:text-white text-xs font-bold'>
|
||||
|
||||
@@ -24,7 +24,6 @@ import NotionPage from '@/components/NotionPage'
|
||||
import { ArticleLock } from './components/ArticleLock'
|
||||
import { Transition } from '@headlessui/react'
|
||||
import { Style } from './style'
|
||||
import CommonHead from '@/components/CommonHead'
|
||||
import BlogPostListAll from './components/BlogPostListAll'
|
||||
import BlogPostCard from './components/BlogPostCard'
|
||||
import Link from 'next/link'
|
||||
@@ -47,7 +46,7 @@ export const useNavGlobal = () => useContext(ThemeGlobalNav)
|
||||
* @constructor
|
||||
*/
|
||||
const LayoutBase = (props) => {
|
||||
const { customMenu, children, post, allNavPages, categoryOptions, slotLeft, slotTop, meta } = props
|
||||
const { customMenu, children, post, allNavPages, categoryOptions, slotLeft, slotTop } = props
|
||||
const { onLoading } = useGlobal()
|
||||
const [tocVisible, changeTocVisible] = useState(false)
|
||||
const [pageNavVisible, changePageNavVisible] = useState(false)
|
||||
@@ -70,8 +69,6 @@ const LayoutBase = (props) => {
|
||||
|
||||
return (
|
||||
<ThemeGlobalNav.Provider value={{ tocVisible, changeTocVisible, filteredNavPages, setFilteredNavPages, allNavPages, pageNavVisible, changePageNavVisible, categoryOptions }}>
|
||||
{/* HEAD */}
|
||||
<CommonHead meta={meta}/>
|
||||
{/* 样式 */}
|
||||
<Style/>
|
||||
|
||||
|
||||
@@ -23,7 +23,6 @@ import Link from 'next/link'
|
||||
import BlogListBar from './components/BlogListBar'
|
||||
import { Style } from './style'
|
||||
import replaceSearchResult from '@/components/Mark'
|
||||
import CommonHead from '@/components/CommonHead'
|
||||
import { siteConfig } from '@/lib/config'
|
||||
import AlgoliaSearchModal from '@/components/AlgoliaSearchModal'
|
||||
import Announcement from './components/Announcement'
|
||||
@@ -39,7 +38,7 @@ export const useNextGlobal = () => useContext(ThemeGlobalNext)
|
||||
* @constructor
|
||||
*/
|
||||
const LayoutBase = (props) => {
|
||||
const { children, headerSlot, rightAreaSlot, meta, post } = props
|
||||
const { children, headerSlot, rightAreaSlot, post } = props
|
||||
const targetRef = useRef(null)
|
||||
const floatButtonGroup = useRef(null)
|
||||
const [showRightFloat, switchShow] = useState(false)
|
||||
@@ -87,8 +86,6 @@ const LayoutBase = (props) => {
|
||||
return (
|
||||
<ThemeGlobalNext.Provider value={{ searchModal }}>
|
||||
<div id='theme-next'>
|
||||
{/* SEO相关 */}
|
||||
<CommonHead meta={meta}/>
|
||||
<Style/>
|
||||
|
||||
{/* 移动端顶部导航栏 */}
|
||||
|
||||
@@ -22,7 +22,6 @@ import BlogListBar from './components/BlogListBar'
|
||||
import { Transition } from '@headlessui/react'
|
||||
import { Style } from './style'
|
||||
import replaceSearchResult from '@/components/Mark'
|
||||
import CommonHead from '@/components/CommonHead'
|
||||
import AlgoliaSearchModal from '@/components/AlgoliaSearchModal'
|
||||
import { siteConfig } from '@/lib/config'
|
||||
|
||||
@@ -37,7 +36,7 @@ export const useNobeliumGlobal = () => useContext(ThemeGlobalNobelium)
|
||||
* @constructor
|
||||
*/
|
||||
const LayoutBase = props => {
|
||||
const { children, post, meta } = props
|
||||
const { children, post } = props
|
||||
const fullWidth = post?.fullWidth ?? false
|
||||
const { onLoading } = useGlobal()
|
||||
const searchModal = useRef(null)
|
||||
@@ -48,9 +47,7 @@ const LayoutBase = props => {
|
||||
return (
|
||||
<ThemeGlobalNobelium.Provider value={{ searchModal, filterKey, setFilterKey }}>
|
||||
<div id='theme-nobelium' className='nobelium relative dark:text-gray-300 w-full bg-white dark:bg-black min-h-screen flex flex-col'>
|
||||
{/* SEO相关 */}
|
||||
<CommonHead meta={meta} />
|
||||
{/* SEO相关 */}
|
||||
|
||||
<Style />
|
||||
|
||||
{/* 顶部导航栏 */}
|
||||
|
||||
@@ -20,7 +20,6 @@ import BottomNav from './components/BottomNav'
|
||||
import Modal from './components/Modal'
|
||||
import { Style } from './style'
|
||||
import replaceSearchResult from '@/components/Mark'
|
||||
import CommonHead from '@/components/CommonHead'
|
||||
import { useRouter } from 'next/router'
|
||||
|
||||
// 主题全局状态
|
||||
@@ -34,7 +33,7 @@ export const usePlogGlobal = () => useContext(ThemeGlobalPlog)
|
||||
* @constructor
|
||||
*/
|
||||
const LayoutBase = props => {
|
||||
const { children, topSlot, meta } = props
|
||||
const { children, topSlot } = props
|
||||
const { onLoading } = useGlobal()
|
||||
const [showModal, setShowModal] = useState(false)
|
||||
const [modalContent, setModalContent] = useState(null)
|
||||
@@ -55,8 +54,7 @@ const LayoutBase = props => {
|
||||
return (
|
||||
<ThemeGlobalPlog.Provider value={{ showModal, setShowModal, modalContent, setModalContent }}>
|
||||
<div id='theme-plog' className='plog relative dark:text-gray-300 w-full dark:bg-black min-h-screen'>
|
||||
{/* SEO相关 */}
|
||||
<CommonHead meta={meta}/>
|
||||
|
||||
<Style/>
|
||||
|
||||
{/* 移动端顶部导航栏 */}
|
||||
|
||||
@@ -27,7 +27,6 @@ const SideBar = dynamic(() => import('./components/SideBar'), { ssr: false });
|
||||
const JumpToTopButton = dynamic(() => import('./components/JumpToTopButton'), { ssr: false });
|
||||
const Footer = dynamic(() => import('./components/Footer'), { ssr: false });
|
||||
const SearchInput = dynamic(() => import('./components/SearchInput'), { ssr: false });
|
||||
const CommonHead = dynamic(() => import('@/components/CommonHead'), { ssr: false });
|
||||
const WWAds = dynamic(() => import('@/components/WWAds'), { ssr: false });
|
||||
const BlogListPage = dynamic(() => import('./components/BlogListPage'), { ssr: false })
|
||||
|
||||
@@ -42,15 +41,14 @@ export const useSimpleGlobal = () => useContext(ThemeGlobalSimple)
|
||||
* @returns
|
||||
*/
|
||||
const LayoutBase = props => {
|
||||
const { children, slotTop, meta } = props
|
||||
const { children, slotTop } = props
|
||||
const { onLoading, fullWidth } = useGlobal()
|
||||
const searchModal = useRef(null)
|
||||
|
||||
return (
|
||||
<ThemeGlobalSimple.Provider value={{ searchModal }}>
|
||||
<div id='theme-simple' className='min-h-screen flex flex-col dark:text-gray-300 bg-white dark:bg-black'>
|
||||
{/* SEO相关 */}
|
||||
<CommonHead meta={meta}/>
|
||||
|
||||
<Style/>
|
||||
|
||||
{siteConfig('SIMPLE_TOP_BAR', null, CONFIG) && <TopBar {...props} />}
|
||||
|
||||
Reference in New Issue
Block a user