mirror of
https://github.com/d0zingcat/NotionNext.git
synced 2026-05-13 23:16:47 +00:00
部分微调
This commit is contained in:
@@ -10,7 +10,7 @@ import { useEffect } from 'react'
|
||||
* @param {*} param0
|
||||
* @returns
|
||||
*/
|
||||
const GlobalHead = props => {
|
||||
const SEO = props => {
|
||||
const { children, siteInfo, post, NOTION_CONFIG } = props
|
||||
let url = siteConfig('PATH')?.length
|
||||
? `${siteConfig('LINK')}/${siteConfig('SUB_PATH', '')}`
|
||||
@@ -275,4 +275,4 @@ const getSEOMeta = (props, router, locale) => {
|
||||
}
|
||||
}
|
||||
|
||||
export default GlobalHead
|
||||
export default SEO
|
||||
@@ -10,12 +10,14 @@ export async function generateSitemapXml({ allPages, NOTION_CONFIG }) {
|
||||
{
|
||||
loc: `${link}`,
|
||||
lastmod: new Date().toISOString().split('T')[0],
|
||||
changefreq: 'daily'
|
||||
changefreq: 'daily',
|
||||
priority: 1.0
|
||||
},
|
||||
{
|
||||
loc: `${link}/archive`,
|
||||
lastmod: new Date().toISOString().split('T')[0],
|
||||
changefreq: 'daily'
|
||||
changefreq: 'daily',
|
||||
priority: 1.0
|
||||
},
|
||||
{
|
||||
loc: `${link}/category`,
|
||||
|
||||
@@ -16,7 +16,7 @@ import { getQueryParam } from '../lib/utils'
|
||||
// 各种扩展插件 这个要阻塞引入
|
||||
import BLOG from '@/blog.config'
|
||||
import ExternalPlugins from '@/components/ExternalPlugins'
|
||||
import GlobalHead from '@/components/GlobalHead'
|
||||
import SEO from '@/components/SEO'
|
||||
import { zhCN } from '@clerk/localizations'
|
||||
import dynamic from 'next/dynamic'
|
||||
// import { ClerkProvider } from '@clerk/nextjs'
|
||||
@@ -55,7 +55,7 @@ const MyApp = ({ Component, pageProps }) => {
|
||||
const content = (
|
||||
<GlobalContextProvider {...pageProps}>
|
||||
<GLayout {...pageProps}>
|
||||
<GlobalHead {...pageProps} />
|
||||
<SEO {...pageProps} />
|
||||
<Component {...pageProps} />
|
||||
</GLayout>
|
||||
<ExternalPlugins {...pageProps} />
|
||||
|
||||
@@ -194,7 +194,7 @@ const LayoutSearch = props => {
|
||||
}
|
||||
}, [])
|
||||
return (
|
||||
<div {...props} currentSearch={currentSearch}>
|
||||
<div currentSearch={currentSearch}>
|
||||
<div id='post-outer-wrapper' className='px-5 md:px-0'>
|
||||
{!currentSearch ? (
|
||||
<SearchNav {...props} />
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { siteConfig } from '@/lib/config'
|
||||
import Link from 'next/link'
|
||||
import CONFIG from '../config'
|
||||
|
||||
/**
|
||||
* 文字广告Banner
|
||||
@@ -8,13 +9,15 @@ import Link from 'next/link'
|
||||
*/
|
||||
export default function BannerItem() {
|
||||
// 首屏信息栏按钮文字
|
||||
const banner = siteConfig('MAGZINE_HOME_BANNER_ENABLE')
|
||||
const button = siteConfig('MAGZINE_HOME_BUTTON')
|
||||
const text = siteConfig('MAGZINE_HOME_BUTTON_TEXT')
|
||||
const url = siteConfig('MAGZINE_HOME_BUTTON_URL')
|
||||
const title = siteConfig('MAGZINE_HOME_TITLE')
|
||||
const description = siteConfig('MAGZINE_HOME_DESCRIPTION')
|
||||
const tips = siteConfig('MAGZINE_HOME_TIPS')
|
||||
const banner = siteConfig('MAGZINE_HOME_BANNER_ENABLE', null, CONFIG)
|
||||
|
||||
const button = siteConfig('MAGZINE_HOME_BUTTON', null, CONFIG)
|
||||
const text = siteConfig('MAGZINE_HOME_BUTTON_TEXT', null, CONFIG)
|
||||
const url = siteConfig('MAGZINE_HOME_BUTTON_URL', null, CONFIG)
|
||||
const title = siteConfig('MAGZINE_HOME_TITLE', null, CONFIG)
|
||||
const description = siteConfig('MAGZINE_HOME_DESCRIPTION', null, CONFIG)
|
||||
const tips = siteConfig('MAGZINE_HOME_TIPS', null, CONFIG)
|
||||
|
||||
if (!banner) {
|
||||
return null
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ export default function CTA({ notice }) {
|
||||
<Announcement
|
||||
post={notice}
|
||||
className={
|
||||
'text-center text-black bg-[#7BE986] dark:bg-hexo-black-gray py-16'
|
||||
'cta text-center text-black bg-[#7BE986] dark:bg-hexo-black-gray py-16'
|
||||
}
|
||||
/>
|
||||
</>
|
||||
|
||||
@@ -62,18 +62,24 @@ const LayoutBase = props => {
|
||||
|
||||
<div
|
||||
id='theme-magzine'
|
||||
className={`${siteConfig('FONT_STYLE')} bg-white dark:bg-hexo-black-gray w-full h-full min-h-screen justify-center dark:text-gray-300 scroll-smooth`}>
|
||||
className={`${siteConfig('FONT_STYLE')} bg-white dark:bg-hexo-black-gray w-full h-full min-h-screen flex flex-col justify-between dark:text-gray-300 scroll-smooth`}>
|
||||
<main
|
||||
id='wrapper'
|
||||
className={'relative flex justify-between w-full h-full mx-auto'}>
|
||||
className='relative flex flex-col justify-between w-full h-full mx-auto'>
|
||||
{/* 主区 */}
|
||||
<div id='container-wrapper' className='w-full relative z-10'>
|
||||
<div
|
||||
id='container-wrapper'
|
||||
className='w-full h-full min-h-screen flex flex-col relative z-10'>
|
||||
<Header {...props} />
|
||||
<div id='main' role='main'>
|
||||
|
||||
<div
|
||||
id='main'
|
||||
role='main'
|
||||
className='flex-grow' // 这个类保证 main 区域填满剩余的空白
|
||||
>
|
||||
{children}
|
||||
</div>
|
||||
{/* 行动呼吁 */}
|
||||
<CTA {...props} />
|
||||
|
||||
<Footer title={siteConfig('TITLE')} />
|
||||
</div>
|
||||
</main>
|
||||
@@ -115,6 +121,9 @@ const LayoutIndex = props => {
|
||||
|
||||
{/* 文章推荐 */}
|
||||
<PostListRecommend {...props} />
|
||||
|
||||
{/* 行动呼吁 */}
|
||||
<CTA {...props} />
|
||||
</div>
|
||||
)
|
||||
}
|
||||
@@ -150,31 +159,28 @@ const LayoutSlug = props => {
|
||||
const { post, recommendPosts, prev, next, lock, validPassword } = props
|
||||
const { locale } = useGlobal()
|
||||
const router = useRouter()
|
||||
|
||||
const waiting404 = siteConfig('POST_WAITING_TIME_FOR_404') * 1000
|
||||
useEffect(() => {
|
||||
// 404
|
||||
if (!post) {
|
||||
setTimeout(
|
||||
() => {
|
||||
if (isBrowser) {
|
||||
const article = document.querySelector(
|
||||
'#article-wrapper #notion-article'
|
||||
)
|
||||
if (!article) {
|
||||
router.push('/404').then(() => {
|
||||
console.warn('找不到页面', router.asPath)
|
||||
})
|
||||
}
|
||||
setTimeout(() => {
|
||||
if (isBrowser) {
|
||||
const article = document.querySelector(
|
||||
'#article-wrapper #notion-article'
|
||||
)
|
||||
if (!article) {
|
||||
router.push('/404').then(() => {
|
||||
console.warn('找不到页面', router.asPath)
|
||||
})
|
||||
}
|
||||
},
|
||||
siteConfig('POST_WAITING_TIME_FOR_404') * 1000
|
||||
)
|
||||
}
|
||||
}, waiting404)
|
||||
}
|
||||
}, [post])
|
||||
|
||||
return (
|
||||
<>
|
||||
<div {...props} className='w-full mx-auto max-w-screen-3xl'>
|
||||
<div className='w-full mx-auto max-w-screen-3xl'>
|
||||
{/* 广告位 */}
|
||||
<WWAds orientation='horizontal' />
|
||||
|
||||
@@ -372,9 +378,11 @@ const LayoutArchive = props => {
|
||||
const Layout404 = props => {
|
||||
return (
|
||||
<>
|
||||
<div className='w-full h-96 py-80 flex justify-center items-center'>
|
||||
<div className='w-full py-40 flex justify-center items-center'>
|
||||
404 Not found.
|
||||
</div>
|
||||
{/* 文章推荐 */}
|
||||
<PostListRecommend {...props} />
|
||||
</>
|
||||
)
|
||||
}
|
||||
|
||||
@@ -191,7 +191,9 @@ const LayoutSlug = props => {
|
||||
setTimeout(
|
||||
() => {
|
||||
if (isBrowser) {
|
||||
const article = document.querySelector('#article-wrapper #notion-article')
|
||||
const article = document.querySelector(
|
||||
'#article-wrapper #notion-article'
|
||||
)
|
||||
if (!article) {
|
||||
router.push('/404').then(() => {
|
||||
console.warn('找不到页面', router.asPath)
|
||||
@@ -205,7 +207,7 @@ const LayoutSlug = props => {
|
||||
}, [post])
|
||||
|
||||
return (
|
||||
<div {...props}>
|
||||
<div>
|
||||
{/* 文章锁 */}
|
||||
{lock && <ArticleLock validPassword={validPassword} />}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user