diff --git a/.env.local b/.env.local index be1af82d8d0..8a0dbf80623 100644 --- a/.env.local +++ b/.env.local @@ -1,5 +1,6 @@ # 环境变量 @see https://www.nextjs.cn/docs/basic-features/environment-variables -NEXT_PUBLIC_VERSION=4.1.0 +NEXT_PUBLIC_VERSION=4.1.2 + # 可在此添加环境变量,去掉最左边的(# )注释即可 # Notion页面ID,必须 diff --git a/README.md b/README.md index dffdd4018d4..33be50b7562 100644 --- a/README.md +++ b/README.md @@ -201,6 +201,9 @@ - **图标**: [Fontawesome](https://fontawesome.com/v6/icons/) +## 🔗 友情链接 +- [Elog](https://github.com/LetTTGACO/elog) Markdown 批量导出工具、开放式跨平台博客解决方案,随意组合写作平台(语雀/Notion/FlowUs/飞书)和博客平台(Hexo/Vitepress/Halo/Confluence/WordPress等) + ## License The MIT License. diff --git a/blog.config.js b/blog.config.js index 7c0358d3e26..11a7cf52743 100644 --- a/blog.config.js +++ b/blog.config.js @@ -324,6 +324,10 @@ const BLOG = { ANALYTICS_CNZZ_ID: process.env.NEXT_PUBLIC_ANALYTICS_CNZZ_ID || '', // 只需要填写站长统计的id, [cnzz_id] -> https://s9.cnzz.com/z_stat.php?id=[cnzz_id]&web_id=[cnzz_id] ANALYTICS_GOOGLE_ID: process.env.NEXT_PUBLIC_ANALYTICS_GOOGLE_ID || '', // 谷歌Analytics的id e.g: G-XXXXXXXXXX + // 51la 站点统计 https://www.51.la/ + ANALYTICS_51LA_ID: process.env.NEXT_PUBLIC_ANALYTICS_51LA_ID || '', // id,在51la后台获取 参阅 https://docs.tangly1024.com/article/notion-next-51-la + ANALYTICS_51LA_CK: process.env.NEXT_PUBLIC_ANALYTICS_51LA_CK || '', // ck,在51la后台获取 + // Matomo 网站统计 MATOMO_HOST_URL: process.env.NEXT_PUBLIC_MATOMO_HOST_URL || '', // Matomo服务器地址,不带斜杠 MATOMO_SITE_ID: process.env.NEXT_PUBLIC_MATOMO_SITE_ID || '', // Matomo网站ID @@ -398,12 +402,14 @@ const BLOG = { IMG_LAZY_LOAD_PLACEHOLDER: process.env.NEXT_PUBLIC_IMG_LAZY_LOAD_PLACEHOLDER || 'data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==', // 懒加载占位图片地址,支持base64或url IMG_URL_TYPE: process.env.NEXT_PUBLIC_IMG_TYPE || 'Notion', // 此配置已失效,请勿使用;AMAZON方案不再支持,仅支持Notion方案。 ['Notion','AMAZON'] 站点图片前缀 默认 Notion:(https://notion.so/images/xx) , AMAZON(https://s3.us-west-2.amazonaws.com/xxx) IMG_SHADOW: process.env.NEXT_PUBLIC_IMG_SHADOW || false, // 文章图片是否自动添加阴影 + IMG_COMPRESS_WIDTH: process.env.NEXT_PUBLIC_IMG_COMPRESS_WIDTH || 800, // Notion图片压缩宽度 // 开发相关 NOTION_ACCESS_TOKEN: process.env.NOTION_ACCESS_TOKEN || '', // Useful if you prefer not to make your database public DEBUG: process.env.NEXT_PUBLIC_DEBUG || false, // 是否显示调试按钮 ENABLE_CACHE: process.env.ENABLE_CACHE || process.env.npm_lifecycle_event === 'build', // 缓存在开发调试和打包过程中选择性开启,正式部署开启此功能意义不大。 isProd: process.env.VERCEL_ENV === 'production', // distinguish between development and production environment (ref: https://vercel.com/docs/environment-variables#system-environment-variables) isProd: process.env.VERCEL_ENV === 'production' // distinguish between development and production environment (ref: https://vercel.com/docs/environment-variables#system-environment-variables) + BUNDLE_ANALYZER: process.env.ANALYZE === 'true' || false, // 是否展示编译依赖内容与大小 VERSION: process.env.NEXT_PUBLIC_VERSION // 版本号 } diff --git a/components/AOSAnimation.js b/components/AOSAnimation.js new file mode 100644 index 00000000000..c5dd4d921e2 --- /dev/null +++ b/components/AOSAnimation.js @@ -0,0 +1,12 @@ +import AOS from 'aos' +import { isBrowser } from 'react-notion-x' + +/** + * 加载滚动动画 + * https://michalsnik.github.io/aos/ + */ +export default function AOSAnimation() { + if (isBrowser) { + AOS.init() + } +} diff --git a/components/Comment.js b/components/Comment.js index 203ed0664c0..4f4107b8597 100644 --- a/components/Comment.js +++ b/components/Comment.js @@ -1,6 +1,6 @@ import dynamic from 'next/dynamic' import Tabs from '@/components/Tabs' -import { isBrowser } from '@/lib/utils' +import { isBrowser, isSearchEngineBot } from '@/lib/utils' import { useRouter } from 'next/router' import Artalk from './Artalk' import { siteConfig } from '@/lib/config' @@ -73,6 +73,10 @@ const Comment = ({ siteInfo, frontMatter, className }) => { const COMMENT_GITALK_CLIENT_ID = siteConfig('COMMENT_GITALK_CLIENT_ID') const COMMENT_WEBMENTION_ENABLE = siteConfig('COMMENT_WEBMENTION_ENABLE') + if (isSearchEngineBot()) { + return null + } + // 当连接中有特殊参数时跳转到评论区 if (isBrowser && ('giscus' in router.query || router.query.target === 'comment')) { setTimeout(() => { diff --git a/components/Equation.js b/components/Equation.js index 4872ad8710e..86685d625f6 100644 --- a/components/Equation.js +++ b/components/Equation.js @@ -8,8 +8,12 @@ const katexSettings = { strict: false } +/** + * 数学公式 + * @param {} param0 + * @returns + */ export const Equation = ({ block, math, inline = false, className, ...rest }) => { -// const { recordMap } = useNotionContext() math = math || getBlockTitle(block, null) if (!math) return null diff --git a/components/ExternalPlugins.js b/components/ExternalPlugins.js index 3c274b55f61..29b31934544 100644 --- a/components/ExternalPlugins.js +++ b/components/ExternalPlugins.js @@ -1,5 +1,6 @@ import { siteConfig } from '@/lib/config' import dynamic from 'next/dynamic' +import LA51 from './LA51' import WebWhiz from './Webwhiz' const TwikooCommentCounter = dynamic(() => import('@/components/TwikooCommentCounter'), { ssr: false }) @@ -22,6 +23,8 @@ const VConsole = dynamic(() => import('@/components/VConsole'), { ssr: false }) const CustomContextMenu = dynamic(() => import('@/components/CustomContextMenu'), { ssr: false }) const DisableCopy = dynamic(() => import('@/components/DisableCopy'), { ssr: false }) const AdBlockDetect = dynamic(() => import('@/components/AdBlockDetect'), { ssr: false }) +const LoadingProgress = dynamic(() => import('@/components/LoadingProgress'), { ssr: false }) +const AosAnimation = dynamic(() => import('@/components/AOSAnimation'), { ssr: false }) /** * 各种插件脚本 @@ -29,145 +32,199 @@ const AdBlockDetect = dynamic(() => import('@/components/AdBlockDetect'), { ssr: * @returns */ const ExternalPlugin = (props) => { + const DISABLE_PLUGIN = siteConfig('DISABLE_PLUGIN') + const THEME_SWITCH = siteConfig('THEME_SWITCH') + const DEBUG = siteConfig('DEBUG') + const ANALYTICS_ACKEE_TRACKER = siteConfig('ANALYTICS_ACKEE_TRACKER') + const ANALYTICS_VERCEL = siteConfig('ANALYTICS_VERCEL') + const ANALYTICS_BUSUANZI_ENABLE = siteConfig('ANALYTICS_BUSUANZI_ENABLE') + const ADSENSE_GOOGLE_ID = siteConfig('ADSENSE_GOOGLE_ID') + const FACEBOOK_APP_ID = siteConfig('FACEBOOK_APP_ID') + const FACEBOOK_PAGE_ID = siteConfig('FACEBOOK_PAGE_ID') + const FIREWORKS = siteConfig('FIREWORKS') + const SAKURA = siteConfig('SAKURA') + const STARRY_SKY = siteConfig('STARRY_SKY') + const MUSIC_PLAYER = siteConfig('MUSIC_PLAYER') + const NEST = siteConfig('NEST') + const FLUTTERINGRIBBON = siteConfig('FLUTTERINGRIBBON') + const COMMENT_TWIKOO_COUNT_ENABLE = siteConfig('COMMENT_TWIKOO_COUNT_ENABLE') + const RIBBON = siteConfig('RIBBON') + const CUSTOM_RIGHT_CLICK_CONTEXT_MENU = siteConfig('CUSTOM_RIGHT_CLICK_CONTEXT_MENU') + const CAN_COPY = siteConfig('CAN_COPY') + const WEB_WHIZ_ENABLED = siteConfig('WEB_WHIZ_ENABLED') + const AD_WWADS_BLOCK_DETECT = siteConfig('AD_WWADS_BLOCK_DETECT') + const CHATBASE_ID = siteConfig('CHATBASE_ID') + const COMMENT_DAO_VOICE_ID = siteConfig('COMMENT_DAO_VOICE_ID') + const AD_WWADS_ID = siteConfig('AD_WWADS_ID') + const COMMENT_TWIKOO_ENV_ID = siteConfig('COMMENT_TWIKOO_ENV_ID') + const COMMENT_TWIKOO_CDN_URL = siteConfig('COMMENT_TWIKOO_CDN_URL') + const COMMENT_ARTALK_SERVER = siteConfig('COMMENT_ARTALK_SERVER') + const COMMENT_ARTALK_JS = siteConfig('COMMENT_ARTALK_JS') + const COMMENT_TIDIO_ID = siteConfig('COMMENT_TIDIO_ID') + const COMMENT_GITTER_ROOM = siteConfig('COMMENT_GITTER_ROOM') + const ANALYTICS_BAIDU_ID = siteConfig('ANALYTICS_BAIDU_ID') + const ANALYTICS_CNZZ_ID = siteConfig('ANALYTICS_CNZZ_ID') + const ANALYTICS_GOOGLE_ID = siteConfig('ANALYTICS_GOOGLE_ID') + const MATOMO_HOST_URL = siteConfig('MATOMO_HOST_URL') + const MATOMO_SITE_ID = siteConfig('MATOMO_SITE_ID') + const ANALYTICS_51LA_ID = siteConfig('ANALYTICS_51LA_ID') + const ANALYTICS_51LA_CK = siteConfig('ANALYTICS_51LA_CK') + + if (DISABLE_PLUGIN) { + return null + } + return <> - {JSON.parse(siteConfig('THEME_SWITCH')) && } - {JSON.parse(siteConfig('DEBUG')) && } - {siteConfig('ANALYTICS_ACKEE_TRACKER') && } - {siteConfig('ANALYTICS_GOOGLE_ID') && } - {siteConfig('ANALYTICS_VERCEL') && } - {JSON.parse(siteConfig('ANALYTICS_BUSUANZI_ENABLE')) && } - {siteConfig('ADSENSE_GOOGLE_ID') && } - {siteConfig('FACEBOOK_APP_ID') && siteConfig('FACEBOOK_PAGE_ID') && } - {JSON.parse(siteConfig('FIREWORKS')) && } - {JSON.parse(siteConfig('SAKURA')) && } - {JSON.parse(siteConfig('STARRY_SKY')) && } - {JSON.parse(siteConfig('MUSIC_PLAYER')) && } - {JSON.parse(siteConfig('NEST')) && } - {JSON.parse(siteConfig('FLUTTERINGRIBBON')) && } - {JSON.parse(siteConfig('COMMENT_TWIKOO_COUNT_ENABLE')) && } - {JSON.parse(siteConfig('RIBBON')) && } - {JSON.parse(siteConfig('CUSTOM_RIGHT_CLICK_CONTEXT_MENU')) && } - {!JSON.parse(siteConfig('CAN_COPY')) && } - {JSON.parse(siteConfig('WEB_WHIZ_ENABLED')) && } - {JSON.parse(siteConfig('AD_WWADS_BLOCK_DETECT')) && } - - - {siteConfig('CHATBASE_ID') && (<> - } + {AD_WWADS_ID && } - {siteConfig('COMMENT_TWIKOO_ENV_ID') &&