From 194cd7ac7d722fa5181c8f320554ae639989b5db Mon Sep 17 00:00:00 2001 From: "tangly1024.com" Date: Tue, 4 Jul 2023 12:39:18 +0800 Subject: [PATCH] MailChimp --- blog.config.js | 6 +- components/NotionPage.js | 2 +- lib/mailchimp.js | 49 ++++ pages/[...slug].js | 2 +- pages/api/subscribe.js | 22 ++ styles/notion.css | 3 + themes/example/LayoutSearch.js | 2 +- themes/example/LayoutSlug.js | 2 +- themes/example/components/BlogListPage.js | 2 +- themes/example/components/BlogListScroll.js | 2 +- themes/fukasawa/LayoutSearch.js | 2 +- themes/fukasawa/components/ArticleDetail.js | 2 +- themes/fukasawa/components/BlogListPage.js | 2 +- themes/fukasawa/components/BlogListScroll.js | 2 +- themes/gitbook/LayoutSearch.js | 2 +- themes/gitbook/LayoutSlug.js | 2 +- themes/gitbook/components/BlogPostListPage.js | 2 +- themes/gitbook/components/NavPostList.js | 2 +- themes/gitbook/components/Progress.js | 2 +- themes/hexo/Layout404.js | 2 +- themes/hexo/LayoutSlug.js | 6 +- themes/hexo/components/Progress.js | 2 +- themes/landing/components/Features.js | 2 +- themes/landing/components/Footer.js | 267 ++++++++++-------- themes/landing/components/Header.js | 6 +- themes/landing/components/Hero.js | 2 +- themes/landing/components/Newsletter.js | 128 +++++---- themes/landing/index.js | 5 +- themes/matery/Layout404.js | 2 +- themes/matery/LayoutBase.js | 2 +- themes/matery/LayoutSearch.js | 2 +- themes/matery/LayoutSlug.js | 4 +- themes/matery/components/Announcement.js | 2 +- themes/matery/components/ArticleLock.js | 2 +- themes/matery/components/BlogPostListPage.js | 2 +- themes/matery/components/Progress.js | 2 +- themes/medium/LayoutSearch.js | 2 +- themes/medium/LayoutSlug.js | 4 +- themes/medium/components/BlogPostListPage.js | 2 +- .../medium/components/BlogPostListScroll.js | 2 +- themes/medium/components/Progress.js | 2 +- themes/next/Layout404.js | 2 +- themes/next/LayoutSearch.js | 2 +- themes/next/LayoutSlug.js | 2 +- themes/next/components/ArticleDetail.js | 4 +- themes/next/components/ArticleLock.js | 2 +- themes/next/components/BlogPostListPage.js | 2 +- themes/next/components/BlogPostListScroll.js | 2 +- themes/next/components/Progress.js | 2 +- themes/nobelium/LayoutSearch.js | 2 +- themes/nobelium/LayoutSlug.js | 2 +- themes/nobelium/components/BlogListPage.js | 2 +- themes/nobelium/components/BlogListScroll.js | 4 +- themes/simple/LayoutSearch.js | 2 +- themes/simple/LayoutSlug.js | 2 +- themes/simple/components/BlogListPage.js | 2 +- themes/simple/components/BlogListScroll.js | 2 +- 57 files changed, 361 insertions(+), 235 deletions(-) create mode 100644 lib/mailchimp.js create mode 100644 pages/api/subscribe.js diff --git a/blog.config.js b/blog.config.js index 76a161b7..83b27132 100644 --- a/blog.config.js +++ b/blog.config.js @@ -33,7 +33,7 @@ const BLOG = { NOTION_HOST: process.env.NEXT_PUBLIC_NOTION_HOST || 'https://www.notion.so', // Notion域名,您可以选择用自己的域名进行反向代理,如果不懂得什么是反向代理,请勿修改此项 // 网站字体 - FONT_STYLE: process.env.NEXT_PUBLIC_FONT_STYLE || 'font-serif', // ['font-serif','font-sans'] 两种可选,分别是衬线和无衬线: 参考 https://www.jianshu.com/p/55e410bd2115 + FONT_STYLE: process.env.NEXT_PUBLIC_FONT_STYLE || 'font-sans', // ['font-serif','font-sans'] 两种可选,分别是衬线和无衬线: 参考 https://www.jianshu.com/p/55e410bd2115 FONT_URL: [ // 字体CSS 例如 https://npm.elemecdn.com/lxgw-wenkai-webfont@1.6.0/style.css 'https://fonts.googleapis.com/css?family=Bitter&display=swap', @@ -319,8 +319,10 @@ const BLOG = { icon: process.env.NEXT_PUBLIC_NOTION_PROPERTY_ICON || 'icon' }, - // RSS + // RSS订阅 ENABLE_RSS: process.env.NEXT_PUBLIC_ENABLE_RSS || true, // 是否开启RSS订阅功能 + MAILCHIMP_LIST_ID: process.env.MAILCHIMP_LIST_ID || null, // 开启mailichimp邮件订阅 客户列表ID ,具体使用方法参阅文档 + MAILCHIMP_API_KEY: process.env.MAILCHIMP_API_KEY || null, // 开启mailichimp邮件订阅 APIkey // 作废配置 AVATAR: process.env.NEXT_PUBLIC_AVATAR || '/avatar.svg', // 作者头像,被notion中的ICON覆盖。若无ICON则取public目录下的avatar.png diff --git a/components/NotionPage.js b/components/NotionPage.js index e389468f..6e6d8e6a 100644 --- a/components/NotionPage.js +++ b/components/NotionPage.js @@ -55,7 +55,7 @@ const NotionPage = ({ post, className }) => { return <>{post?.summary || ''} } - return
+ return
{ }) } } - }, 5 * 1000) // 404时长 8秒 + }, 8 * 1000) // 404时长 8秒 } // 文章加密 diff --git a/pages/api/subscribe.js b/pages/api/subscribe.js new file mode 100644 index 00000000..86adddf9 --- /dev/null +++ b/pages/api/subscribe.js @@ -0,0 +1,22 @@ +import subscribeToMailchimpApi from '@/lib/mailchimp' + +/** + * 接受邮件订阅 + * @param {*} req + * @param {*} res + */ +export default async function handler(req, res) { + if (req.method === 'POST') { + const { email, firstName, lastName } = req.body + try { + const response = await subscribeToMailchimpApi({ email, first_name: firstName, last_name: lastName }) + const data = await response.json() + console.log('data', data) + res.status(200).json({ status: 'success', message: 'Subscription successful!' }) + } catch (error) { + res.status(400).json({ status: 'error', message: 'Subscription failed!', error }) + } + } else { + res.status(405).json({ status: 'error', message: 'Method not allowed' }) + } +} diff --git a/styles/notion.css b/styles/notion.css index 8e999ad6..dbc3b804 100644 --- a/styles/notion.css +++ b/styles/notion.css @@ -2043,3 +2043,6 @@ code.language-mermaid { @apply dark:fill-gray-200 !important; } +.notion-external-image { + @apply w-6 h-6 mx-3 my-2 !important; +} diff --git a/themes/example/LayoutSearch.js b/themes/example/LayoutSearch.js index 4b120d09..29b2d5e1 100644 --- a/themes/example/LayoutSearch.js +++ b/themes/example/LayoutSearch.js @@ -14,7 +14,7 @@ const LayoutSearch = props => { useEffect(() => { setTimeout(() => { - const container = isBrowser() && document.getElementById('container') + const container = isBrowser() && document.getElementById('posts-wrapper') if (container && container.innerHTML) { const re = new RegExp(keyword, 'gim') const instance = new Mark(container) diff --git a/themes/example/LayoutSlug.js b/themes/example/LayoutSlug.js index 2ab9c557..20f886b3 100644 --- a/themes/example/LayoutSlug.js +++ b/themes/example/LayoutSlug.js @@ -17,7 +17,7 @@ export const LayoutSlug = props => { {lock && } - {!lock &&
+ {!lock &&
{post && <> diff --git a/themes/example/components/BlogListPage.js b/themes/example/components/BlogListPage.js index 18a87870..0c4dbd7a 100644 --- a/themes/example/components/BlogListPage.js +++ b/themes/example/components/BlogListPage.js @@ -22,7 +22,7 @@ export const BlogListPage = props => { return (
-
+
{posts?.map(post => ( ))} diff --git a/themes/example/components/BlogListScroll.js b/themes/example/components/BlogListScroll.js index e1d0c2ae..1f0f302d 100644 --- a/themes/example/components/BlogListScroll.js +++ b/themes/example/components/BlogListScroll.js @@ -47,7 +47,7 @@ export const BlogListScroll = props => { return ( -
+
{postsToShow?.map(post => ( diff --git a/themes/fukasawa/LayoutSearch.js b/themes/fukasawa/LayoutSearch.js index 58aeaf88..9efb3160 100644 --- a/themes/fukasawa/LayoutSearch.js +++ b/themes/fukasawa/LayoutSearch.js @@ -13,7 +13,7 @@ export const LayoutSearch = (props) => { const currentSearch = keyword || router?.query?.s useEffect(() => { setTimeout(() => { - const container = isBrowser() && document.getElementById('container') + const container = isBrowser() && document.getElementById('posts-wrapper') if (container && container.innerHTML) { const re = new RegExp(currentSearch, 'gim') const instance = new Mark(container) diff --git a/themes/fukasawa/components/ArticleDetail.js b/themes/fukasawa/components/ArticleDetail.js index 8cfdaba4..afcb2cc9 100644 --- a/themes/fukasawa/components/ArticleDetail.js +++ b/themes/fukasawa/components/ArticleDetail.js @@ -86,7 +86,7 @@ export default function ArticleDetail(props) { {/* Notion文章主体 */} -
+
{post && }
diff --git a/themes/fukasawa/components/BlogListPage.js b/themes/fukasawa/components/BlogListPage.js index 3ef8dee3..18799d8b 100644 --- a/themes/fukasawa/components/BlogListPage.js +++ b/themes/fukasawa/components/BlogListPage.js @@ -52,7 +52,7 @@ const BlogListPage = ({ page = 1, posts = [], postCount, siteInfo }) => { return (
{/* 文章列表 */} -
+
{filterPosts?.map(post => (
diff --git a/themes/fukasawa/components/BlogListScroll.js b/themes/fukasawa/components/BlogListScroll.js index fad59cec..b1752000 100644 --- a/themes/fukasawa/components/BlogListScroll.js +++ b/themes/fukasawa/components/BlogListScroll.js @@ -55,7 +55,7 @@ const BlogListScroll = props => { return } else { return ( -
+
{/* 文章列表 */} {postsToShow?.map(post => (
diff --git a/themes/gitbook/LayoutSearch.js b/themes/gitbook/LayoutSearch.js index f67fd1b0..f6ba05ac 100644 --- a/themes/gitbook/LayoutSearch.js +++ b/themes/gitbook/LayoutSearch.js @@ -19,7 +19,7 @@ export const LayoutSearch = (props) => { useEffect(() => { setTimeout(() => { - const container = isBrowser() && document.getElementById('container') + const container = isBrowser() && document.getElementById('posts-wrapper') if (container && container.innerHTML) { const re = new RegExp(currentSearch, 'gim') const instance = new Mark(container) diff --git a/themes/gitbook/LayoutSlug.js b/themes/gitbook/LayoutSlug.js index 6a6bef08..b5445883 100644 --- a/themes/gitbook/LayoutSlug.js +++ b/themes/gitbook/LayoutSlug.js @@ -25,7 +25,7 @@ export const LayoutSlug = (props) => {

{post?.title}

{/* Notion文章主体 */} - {post && (
+ {post && (
)} diff --git a/themes/gitbook/components/BlogPostListPage.js b/themes/gitbook/components/BlogPostListPage.js index a77b288b..d9228b51 100644 --- a/themes/gitbook/components/BlogPostListPage.js +++ b/themes/gitbook/components/BlogPostListPage.js @@ -20,7 +20,7 @@ const BlogPostListPage = ({ page = 1, posts = [], postCount }) => { return (
-
+
{/* 文章列表 */} {posts?.map(post => ( diff --git a/themes/gitbook/components/NavPostList.js b/themes/gitbook/components/NavPostList.js index 0ef304d2..c0248296 100644 --- a/themes/gitbook/components/NavPostList.js +++ b/themes/gitbook/components/NavPostList.js @@ -36,7 +36,7 @@ const NavPostList = (props) => { if (!filteredPosts || filteredPosts.length === 0) { return } else { - return
+ return
{/* 文章列表 */} {filteredPosts?.map((group, index) => )}
diff --git a/themes/gitbook/components/Progress.js b/themes/gitbook/components/Progress.js index 48ba8e14..bca7a17d 100644 --- a/themes/gitbook/components/Progress.js +++ b/themes/gitbook/components/Progress.js @@ -10,7 +10,7 @@ const Progress = ({ targetRef, showPercent = true }) => { const currentRef = targetRef?.current || targetRef const [percent, changePercent] = useState(0) const scrollListener = () => { - const target = currentRef || (isBrowser() && document.getElementById('container')) + const target = currentRef || (isBrowser() && document.getElementById('posts-wrapper')) if (target) { const clientHeight = target.clientHeight const scrollY = window.pageYOffset diff --git a/themes/hexo/Layout404.js b/themes/hexo/Layout404.js index fcf2bf2c..5dfe020f 100644 --- a/themes/hexo/Layout404.js +++ b/themes/hexo/Layout404.js @@ -7,7 +7,7 @@ export const Layout404 = props => { useEffect(() => { // 延时3秒如果加载失败就返回首页 setTimeout(() => { - const article = typeof document !== 'undefined' && document.getElementById('container') + const article = typeof document !== 'undefined' && document.getElementById('notion-article') if (!article) { router.push('/').then(() => { // console.log('找不到页面', router.asPath) diff --git a/themes/hexo/LayoutSlug.js b/themes/hexo/LayoutSlug.js index 514a3c4e..5e2663fa 100644 --- a/themes/hexo/LayoutSlug.js +++ b/themes/hexo/LayoutSlug.js @@ -26,7 +26,7 @@ export const LayoutSlug = props => { > } - const targetRef = isBrowser() ? document.getElementById('container') : null + const targetRef = isBrowser() ? document.getElementById('article-wrapper') : null const floatSlot = <> {post?.toc?.length > 1 &&
@@ -50,11 +50,11 @@ export const LayoutSlug = props => {
{lock && } - {!lock &&
+ {!lock &&
{/* Notion文章主体 */} -
+
{post && }
diff --git a/themes/hexo/components/Progress.js b/themes/hexo/components/Progress.js index dbdadd16..5b4f9b20 100644 --- a/themes/hexo/components/Progress.js +++ b/themes/hexo/components/Progress.js @@ -10,7 +10,7 @@ const Progress = ({ targetRef, showPercent = true }) => { const currentRef = targetRef?.current || targetRef const [percent, changePercent] = useState(0) const scrollListener = () => { - const target = currentRef || (isBrowser() && document.getElementById('container')) + const target = currentRef || (isBrowser() && document.getElementById('article-wrapper')) if (target) { const clientHeight = target.clientHeight const scrollY = window.pageYOffset diff --git a/themes/landing/components/Features.js b/themes/landing/components/Features.js index a4925e4b..68aaa36d 100644 --- a/themes/landing/components/Features.js +++ b/themes/landing/components/Features.js @@ -31,7 +31,7 @@ export default function Features() { {/* Section header */}

探索解决方案

-

个人或小企业有什么方法可以快速搭建自己的站点,塑造一个品牌展示中心?
以前,它是繁重的Wordpress,它是操作复杂的Hexo,它是一个昂贵的研发外包团队;但现在,您只要一个笔记软件、Notion就够了

+

如何搭建自己的门户网站,塑造一个品牌展示中心?
以前,它是系统繁重的Wordpress,它是操作复杂的Hexo,它是一个昂贵的研发外包团队;但现在,您只要一个笔记软件、Notion就够了

{/* Section content */} diff --git a/themes/landing/components/Footer.js b/themes/landing/components/Footer.js index 0d407af2..78facbd9 100644 --- a/themes/landing/components/Footer.js +++ b/themes/landing/components/Footer.js @@ -1,149 +1,174 @@ +import { subscribeToNewsletter } from '@/lib/mailchimp' +import { useEffect, useRef, useState } from 'react' import Logo from './Logo' export default function Footer() { + const formRef = useRef() + const [success, setSuccess] = useState(false) + useEffect(() => { + const form = formRef.current + const handleSubmit = (e) => { + e.preventDefault() + const email = document.querySelector('#newsletter').value + subscribeToNewsletter(email).then(response => { + console.log('Subscription succeeded:', response) + // 在此处添加成功订阅后的操作 + setSuccess(true) + }) + .catch(error => { + console.error('Subscription failed:', error) + // 在此处添加订阅失败后的操作 + }) + } + form.addEventListener('submit', handleSubmit) + return () => { + form.removeEventListener('submit', handleSubmit) + } + }, [subscribeToNewsletter]) + return ( - ) } diff --git a/themes/landing/components/Header.js b/themes/landing/components/Header.js index 693774bd..e27deaf9 100644 --- a/themes/landing/components/Header.js +++ b/themes/landing/components/Header.js @@ -35,12 +35,12 @@ export default function Header() { {/* Desktop sign in links */}
  • - -
    Github
    + +
    Github开源
  • - + 我的博客 diff --git a/themes/landing/components/Hero.js b/themes/landing/components/Hero.js index 776fab20..47cd7e25 100644 --- a/themes/landing/components/Hero.js +++ b/themes/landing/components/Hero.js @@ -30,7 +30,7 @@ export default function Hero() {

    NotionNext

    -

    只需一个Notion笔记就可以搭建各种网站,这也许是成本最低、最快的建站方案

    +

    一个笔记软件、一个脚本工具,建站从未如此简单!

    开始体验 diff --git a/themes/landing/components/Newsletter.js b/themes/landing/components/Newsletter.js index 7e499843..1e788a4b 100644 --- a/themes/landing/components/Newsletter.js +++ b/themes/landing/components/Newsletter.js @@ -1,63 +1,89 @@ +import { subscribeToNewsletter } from '@/lib/mailchimp' +import { useEffect, useRef, useState } from 'react' + export default function Newsletter() { + const formRef = useRef() + const [success, setSuccess] = useState(false) + useEffect(() => { + const form = formRef.current + const handleSubmit = (e) => { + e.preventDefault() + const email = document.querySelector('#newsletter').value + subscribeToNewsletter(email).then(response => { + console.log('Subscription succeeded:', response) + // 在此处添加成功订阅后的操作 + setSuccess(true) + }) + .catch(error => { + console.error('Subscription failed:', error) + // 在此处添加订阅失败后的操作 + }) + } + form.addEventListener('submit', handleSubmit) + return () => { + form.removeEventListener('submit', handleSubmit) + } + }, [subscribeToNewsletter]) + return ( -
    -
    -
    +
    +
    +
    - {/* CTA box */} -
    + {/* CTA box */} +
    - {/* Background illustration */} - + {/* Background illustration */} + -
    +
    - {/* CTA content */} -
    -

    需要更多的教程和帮助?

    -

    请留下您的电子邮件,我会第一时间与您取得联系

    + {/* CTA content */} +
    +

    需要更多的教程和帮助?

    +

    请留下您的电子邮件,我会第一时间与您取得联系

    + + {/* CTA form */} +
    +
    + + +
    + {/* Success message */} + {success &&

    感谢您的订阅!

    } + {!success &&

    没有垃圾邮件,您可以随时取消订阅

    } +
    +
    + +
    - {/* CTA form */} -
    -
    - - Subscribe
    - {/* Success message */} - {/*

    Thanks for subscribing!

    */} -

    没有垃圾邮件,您可以随时取消订阅

    -
    +
    - -
    -
    - -
    -
    -
    +
    ) } diff --git a/themes/landing/index.js b/themes/landing/index.js index b6df961b..cee7e83f 100644 --- a/themes/landing/index.js +++ b/themes/landing/index.js @@ -28,7 +28,7 @@ const THEME_CONFIG = { THEME: 'landing' } * @returns */ const LayoutBase = (props) => { - const { siteInfo, children } = props + const { children } = props return
    {/* 顶部导航栏 */}
    @@ -50,7 +50,6 @@ const LayoutBase = (props) => { * @returns */ const LayoutIndex = (props) => { - const { siteInfo } = props return ( @@ -68,7 +67,7 @@ const LayoutIndex = (props) => { * @returns */ const LayoutSlug = (props) => -
    +
    diff --git a/themes/matery/Layout404.js b/themes/matery/Layout404.js index 21fcade3..dff7a952 100644 --- a/themes/matery/Layout404.js +++ b/themes/matery/Layout404.js @@ -7,7 +7,7 @@ export const Layout404 = props => { useEffect(() => { // 延时3秒如果加载失败就返回首页 setTimeout(() => { - const article = typeof document !== 'undefined' && document.getElementById('container') + const article = typeof document !== 'undefined' && document.getElementById('notion-article') if (!article) { router.push('/').then(() => { // console.log('找不到页面', router.asPath) diff --git a/themes/matery/LayoutBase.js b/themes/matery/LayoutBase.js index 282cc44b..66954859 100644 --- a/themes/matery/LayoutBase.js +++ b/themes/matery/LayoutBase.js @@ -54,7 +54,7 @@ const LayoutBase = props => {
    {/* 嵌入区域 */} -
    +
    {props.containerSlot}
    diff --git a/themes/matery/LayoutSearch.js b/themes/matery/LayoutSearch.js index 10df7b11..0de3ed54 100644 --- a/themes/matery/LayoutSearch.js +++ b/themes/matery/LayoutSearch.js @@ -89,7 +89,7 @@ export const LayoutSearch = props => { } {currentSearch && <> -
    +
    {BLOG.POST_LIST_STYLE === 'page' ? : }
    } diff --git a/themes/matery/LayoutSlug.js b/themes/matery/LayoutSlug.js index d3753764..e5a4fc53 100644 --- a/themes/matery/LayoutSlug.js +++ b/themes/matery/LayoutSlug.js @@ -54,7 +54,7 @@ export const LayoutSlug = props => {
    {lock && } - {!lock &&
    + {!lock &&
    {post?.type && post?.type === 'Post' && <>
    {
    {/* Notion文章主体 */} -
    +
    {post && }
    diff --git a/themes/matery/components/Announcement.js b/themes/matery/components/Announcement.js index d1ad1ac3..9ec52443 100644 --- a/themes/matery/components/Announcement.js +++ b/themes/matery/components/Announcement.js @@ -5,7 +5,7 @@ const NotionPage = dynamic(() => import('@/components/NotionPage')) const Announcement = ({ notice }) => { const { locale } = useGlobal() - if (!notice) { + if (!notice || Object.keys(notice).length === 0) { return <> } return
    diff --git a/themes/matery/components/ArticleLock.js b/themes/matery/components/ArticleLock.js index 88de8ba6..ad63d0de 100644 --- a/themes/matery/components/ArticleLock.js +++ b/themes/matery/components/ArticleLock.js @@ -28,7 +28,7 @@ export const ArticleLock = props => { passwordInputRef.current.focus() }, []) - return
    + return
    {locale.COMMON.ARTICLE_LOCK_TIPS}
    diff --git a/themes/matery/components/BlogPostListPage.js b/themes/matery/components/BlogPostListPage.js index 24b84c15..7d5226dc 100644 --- a/themes/matery/components/BlogPostListPage.js +++ b/themes/matery/components/BlogPostListPage.js @@ -18,7 +18,7 @@ const BlogPostListPage = ({ page = 1, posts = [], postCount, siteInfo }) => { return } else { return ( -
    +
    {/* 文章列表 */}
    diff --git a/themes/matery/components/Progress.js b/themes/matery/components/Progress.js index 985ffac4..d6a68fe8 100644 --- a/themes/matery/components/Progress.js +++ b/themes/matery/components/Progress.js @@ -11,7 +11,7 @@ const Progress = ({ targetRef, showPercent = true }) => { const [percent, changePercent] = useState(0) const scrollListener = () => { requestAnimationFrame(() => { - const target = currentRef || (isBrowser() && document.getElementById('container')) + const target = currentRef || (isBrowser() && document.getElementById('article-wrapper')) if (target) { const clientHeight = target.clientHeight const scrollY = window.pageYOffset diff --git a/themes/medium/LayoutSearch.js b/themes/medium/LayoutSearch.js index 1aaf3d20..e7fee4c2 100644 --- a/themes/medium/LayoutSearch.js +++ b/themes/medium/LayoutSearch.js @@ -19,7 +19,7 @@ export const LayoutSearch = (props) => { useEffect(() => { setTimeout(() => { - const container = isBrowser() && document.getElementById('container') + const container = isBrowser() && document.getElementById('posts-wrapper') if (container && container.innerHTML) { const re = new RegExp(currentSearch, 'gim') const instance = new Mark(container) diff --git a/themes/medium/LayoutSlug.js b/themes/medium/LayoutSlug.js index 39b4103e..e0ddfbde 100644 --- a/themes/medium/LayoutSlug.js +++ b/themes/medium/LayoutSlug.js @@ -39,7 +39,7 @@ export const LayoutSlug = props => { {/* 文章锁 */} {lock && } - {!lock &&
    + {!lock &&
    {/* title */}

    {post?.title}

    @@ -67,7 +67,7 @@ export const LayoutSlug = props => {
    {/* Notion文章主体 */} -
    +
    {post && ()}
    diff --git a/themes/medium/components/BlogPostListPage.js b/themes/medium/components/BlogPostListPage.js index db74b74e..0d20123c 100644 --- a/themes/medium/components/BlogPostListPage.js +++ b/themes/medium/components/BlogPostListPage.js @@ -20,7 +20,7 @@ const BlogPostListPage = ({ page = 1, posts = [], postCount }) => { return (
    -
    +
    {/* 文章列表 */} {posts?.map(post => ( diff --git a/themes/medium/components/BlogPostListScroll.js b/themes/medium/components/BlogPostListScroll.js index 2c7eafbd..59a6bd07 100644 --- a/themes/medium/components/BlogPostListScroll.js +++ b/themes/medium/components/BlogPostListScroll.js @@ -61,7 +61,7 @@ const BlogPostListScroll = ({ posts = [], currentSearch }) => { if (!postsToShow || postsToShow.length === 0) { return } else { - return
    + return
    {/* 文章列表 */}
    diff --git a/themes/medium/components/Progress.js b/themes/medium/components/Progress.js index 48ba8e14..b57a3bb5 100644 --- a/themes/medium/components/Progress.js +++ b/themes/medium/components/Progress.js @@ -10,7 +10,7 @@ const Progress = ({ targetRef, showPercent = true }) => { const currentRef = targetRef?.current || targetRef const [percent, changePercent] = useState(0) const scrollListener = () => { - const target = currentRef || (isBrowser() && document.getElementById('container')) + const target = currentRef || (isBrowser() && document.getElementById('article-wrapper')) if (target) { const clientHeight = target.clientHeight const scrollY = window.pageYOffset diff --git a/themes/next/Layout404.js b/themes/next/Layout404.js index 61c48d37..f4b70dd9 100644 --- a/themes/next/Layout404.js +++ b/themes/next/Layout404.js @@ -8,7 +8,7 @@ export const Layout404 = props => { useEffect(() => { // 延时3秒如果加载失败就返回首页 setTimeout(() => { - const article = isBrowser() && document.getElementById('container') + const article = isBrowser() && document.getElementById('article-wrapper') if (!article) { router.push('/').then(() => { // console.log('找不到页面', router.asPath) diff --git a/themes/next/LayoutSearch.js b/themes/next/LayoutSearch.js index 31e102fd..44a288d5 100644 --- a/themes/next/LayoutSearch.js +++ b/themes/next/LayoutSearch.js @@ -11,7 +11,7 @@ export const LayoutSearch = (props) => { const { locale } = useGlobal() const { posts, keyword } = props setTimeout(() => { - const container = isBrowser() && document.getElementById('container') + const container = isBrowser() && document.getElementById('posts-wrapper') if (container && container.innerHTML) { const re = new RegExp(keyword, 'gim') const instance = new Mark(container) diff --git a/themes/next/LayoutSlug.js b/themes/next/LayoutSlug.js index 9870d457..4c5cb066 100644 --- a/themes/next/LayoutSlug.js +++ b/themes/next/LayoutSlug.js @@ -12,7 +12,7 @@ import { isBrowser } from '@/lib/utils' export const LayoutSlug = (props) => { const { post, latestPosts, lock, validPassword } = props const drawerRight = useRef(null) - const targetRef = isBrowser() ? document.getElementById('container') : null + const targetRef = isBrowser() ? document.getElementById('article-wrapper') : null const floatSlot = post?.toc?.length > 1 ?
    { drawerRight?.current?.handleSwitchVisible() diff --git a/themes/next/components/ArticleDetail.js b/themes/next/components/ArticleDetail.js index 9ad41107..2c27d69a 100644 --- a/themes/next/components/ArticleDetail.js +++ b/themes/next/components/ArticleDetail.js @@ -25,7 +25,7 @@ export default function ArticleDetail(props) { const showArticleInfo = CONFIG_NEXT.ARTICLE_INFO return ( -
    } {/* Notion内容主体 */} -
    +
    {post && ()}
    diff --git a/themes/next/components/ArticleLock.js b/themes/next/components/ArticleLock.js index d49f1e50..ff2db021 100644 --- a/themes/next/components/ArticleLock.js +++ b/themes/next/components/ArticleLock.js @@ -30,7 +30,7 @@ export const ArticleLock = props => { }, []) return ( -
    +
    {locale.COMMON.ARTICLE_LOCK_TIPS}
    diff --git a/themes/next/components/BlogPostListPage.js b/themes/next/components/BlogPostListPage.js index 773b59a4..c87e626a 100644 --- a/themes/next/components/BlogPostListPage.js +++ b/themes/next/components/BlogPostListPage.js @@ -20,7 +20,7 @@ const BlogPostListPage = ({ page = 1, posts = [], postCount }) => { return (
    {/* 文章列表 */} -
    +
    {posts?.map(post => ( ))} diff --git a/themes/next/components/BlogPostListScroll.js b/themes/next/components/BlogPostListScroll.js index 5fb8e274..5c706017 100644 --- a/themes/next/components/BlogPostListScroll.js +++ b/themes/next/components/BlogPostListScroll.js @@ -55,7 +55,7 @@ const BlogPostListScroll = ({ posts = [], currentSearch, showSummary = CONFIG_NE return
    {/* 文章列表 */} -
    +
    {postsToShow.map(post => ( ))} diff --git a/themes/next/components/Progress.js b/themes/next/components/Progress.js index ab59fafd..2f29064d 100644 --- a/themes/next/components/Progress.js +++ b/themes/next/components/Progress.js @@ -10,7 +10,7 @@ const Progress = ({ targetRef, showPercent = true }) => { const currentRef = targetRef?.current || targetRef const [percent, changePercent] = useState(0) const scrollListener = () => { - const target = currentRef || (isBrowser() && document.getElementById('container')) + const target = currentRef || (isBrowser() && document.getElementById('article-wrapper')) if (target) { const clientHeight = target.clientHeight const scrollY = window.pageYOffset diff --git a/themes/nobelium/LayoutSearch.js b/themes/nobelium/LayoutSearch.js index b1995820..84988d6a 100644 --- a/themes/nobelium/LayoutSearch.js +++ b/themes/nobelium/LayoutSearch.js @@ -15,7 +15,7 @@ export const LayoutSearch = props => { useEffect(() => { setTimeout(() => { - const container = isBrowser() && document.getElementById('container') + const container = isBrowser() && document.getElementById('posts-wrapper') if (container && container.innerHTML) { const re = new RegExp(keyword, 'gim') const instance = new Mark(container) diff --git a/themes/nobelium/LayoutSlug.js b/themes/nobelium/LayoutSlug.js index 4a98a641..b65af371 100644 --- a/themes/nobelium/LayoutSlug.js +++ b/themes/nobelium/LayoutSlug.js @@ -18,7 +18,7 @@ export const LayoutSlug = props => { {lock && } - {!lock &&
    + {!lock &&
    <> diff --git a/themes/nobelium/components/BlogListPage.js b/themes/nobelium/components/BlogListPage.js index 1c57d734..5be138de 100644 --- a/themes/nobelium/components/BlogListPage.js +++ b/themes/nobelium/components/BlogListPage.js @@ -19,7 +19,7 @@ export const BlogListPage = props => { return (
    -
    +
    {posts?.map(post => ( ))} diff --git a/themes/nobelium/components/BlogListScroll.js b/themes/nobelium/components/BlogListScroll.js index d70e4bc5..157e80e4 100644 --- a/themes/nobelium/components/BlogListScroll.js +++ b/themes/nobelium/components/BlogListScroll.js @@ -44,7 +44,7 @@ export const BlogListScroll = props => { }) return ( -
    +
    {postsToShow.map(p => (

    @@ -78,5 +78,5 @@ export const BlogListScroll = props => {

    - ); + ) } diff --git a/themes/simple/LayoutSearch.js b/themes/simple/LayoutSearch.js index 597e7c25..a3e41543 100644 --- a/themes/simple/LayoutSearch.js +++ b/themes/simple/LayoutSearch.js @@ -13,7 +13,7 @@ export const LayoutSearch = props => { useEffect(() => { setTimeout(() => { - const container = isBrowser() && document.getElementById('container') + const container = isBrowser() && document.getElementById('posts-wrapper') if (container && container.innerHTML) { const re = new RegExp(keyword, 'gim') const instance = new Mark(container) diff --git a/themes/simple/LayoutSlug.js b/themes/simple/LayoutSlug.js index 11c0a850..48f1f9db 100644 --- a/themes/simple/LayoutSlug.js +++ b/themes/simple/LayoutSlug.js @@ -15,7 +15,7 @@ export const LayoutSlug = props => { {lock && } -
    +
    diff --git a/themes/simple/components/BlogListPage.js b/themes/simple/components/BlogListPage.js index 9da28e2a..e05d4ecf 100644 --- a/themes/simple/components/BlogListPage.js +++ b/themes/simple/components/BlogListPage.js @@ -18,7 +18,7 @@ export const BlogListPage = props => { return (
    -
    +
    {posts?.map((p, index) => (
    {(index + 1) % 3 === 0 && } { (index + 1) === 4 && } diff --git a/themes/simple/components/BlogListScroll.js b/themes/simple/components/BlogListScroll.js index b1a12bc5..dc0b7dd3 100644 --- a/themes/simple/components/BlogListScroll.js +++ b/themes/simple/components/BlogListScroll.js @@ -44,7 +44,7 @@ export const BlogListScroll = props => { }) return ( -
    +
    {postsToShow.map(p => ( ))}