diff --git a/components/GlobalHead.js b/components/SEO.js similarity index 99% rename from components/GlobalHead.js rename to components/SEO.js index 0bd3dccab39..592154dba4c 100644 --- a/components/GlobalHead.js +++ b/components/SEO.js @@ -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 diff --git a/lib/sitemap.xml.js b/lib/sitemap.xml.js index 7ec0551861c..fde90c88c74 100644 --- a/lib/sitemap.xml.js +++ b/lib/sitemap.xml.js @@ -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`, diff --git a/pages/_app.js b/pages/_app.js index 12002916580..80333a643b1 100644 --- a/pages/_app.js +++ b/pages/_app.js @@ -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 = ( - + diff --git a/themes/heo/index.js b/themes/heo/index.js index 3df48ce48be..b3c966ed332 100644 --- a/themes/heo/index.js +++ b/themes/heo/index.js @@ -194,7 +194,7 @@ const LayoutSearch = props => { } }, []) return ( -
+
{!currentSearch ? ( diff --git a/themes/magzine/components/BannerItem.js b/themes/magzine/components/BannerItem.js index 3e77271a010..1d4fdcfb3aa 100644 --- a/themes/magzine/components/BannerItem.js +++ b/themes/magzine/components/BannerItem.js @@ -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 } diff --git a/themes/magzine/components/CTA.js b/themes/magzine/components/CTA.js index ce5f8bd80f2..7458974ea5d 100644 --- a/themes/magzine/components/CTA.js +++ b/themes/magzine/components/CTA.js @@ -12,7 +12,7 @@ export default function CTA({ notice }) { diff --git a/themes/magzine/index.js b/themes/magzine/index.js index bdfb2c72ab4..07dcd4539df 100644 --- a/themes/magzine/index.js +++ b/themes/magzine/index.js @@ -62,18 +62,24 @@ const LayoutBase = props => {
+ 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`}>
+ className='relative flex flex-col justify-between w-full h-full mx-auto'> {/* 主区 */} -
+
-
+ +
{children}
- {/* 行动呼吁 */} - +
@@ -115,6 +121,9 @@ const LayoutIndex = props => { {/* 文章推荐 */} + + {/* 行动呼吁 */} +
) } @@ -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 ( <> -
+
{/* 广告位 */} @@ -372,9 +378,11 @@ const LayoutArchive = props => { const Layout404 = props => { return ( <> -
+
404 Not found.
+ {/* 文章推荐 */} + ) } diff --git a/themes/medium/index.js b/themes/medium/index.js index dfd37ce2cc0..cbb766144dc 100644 --- a/themes/medium/index.js +++ b/themes/medium/index.js @@ -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 ( -
+
{/* 文章锁 */} {lock && }