diff --git a/.env.local b/.env.local new file mode 100644 index 0000000000..7158d5636c --- /dev/null +++ b/.env.local @@ -0,0 +1,2 @@ +# 环境变量 @see https://www.nextjs.cn/docs/basic-features/environment-variables +NEXT_PUBLIC_VERSION=3.3.2 \ No newline at end of file diff --git a/.gitignore b/.gitignore index f5b2d6fe4d..dcb5930fe0 100644 --- a/.gitignore +++ b/.gitignore @@ -25,7 +25,7 @@ yarn-debug.log* yarn-error.log* # local env files -.env.local +# .env.local # 版本号放在此环境变量中 .env.development.local .env.test.local .env.production.local diff --git a/blog.config.js b/blog.config.js index 7b94df71c6..3d73958979 100644 --- a/blog.config.js +++ b/blog.config.js @@ -127,7 +127,7 @@ const BLOG = { process.env.NEXT_PUBLIC_DESCRIPTION || '这是一个由NotionNext生成的站点', // 站点描述,被notion中的页面描述覆盖 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) - VERSION: '3.3.1' // 版本号 + VERSION: process.env.NEXT_PUBLIC_VERSION // 版本号 } module.exports = BLOG diff --git a/components/NotionPage.js b/components/NotionPage.js index 29fe3bedf3..0c60ce32e1 100644 --- a/components/NotionPage.js +++ b/components/NotionPage.js @@ -39,17 +39,19 @@ const NotionPage = ({ post }) => { addWatch4Dom() }, []) setTimeout(() => { - // 将相册gallery下的图片加入放大功能 - const imgList = document?.querySelectorAll('.notion-collection-card-cover img') - if (imgList && zoomRef.current) { - for (let i = 0; i < imgList.length; i++) { - (zoomRef.current).attach(imgList[i]) + if (typeof document !== 'undefined') { + // 将相册gallery下的图片加入放大功能 + const imgList = document.querySelectorAll('.notion-collection-card-cover img') + if (imgList && zoomRef.current) { + for (let i = 0; i < imgList.length; i++) { + (zoomRef.current).attach(imgList[i]) + } } - } - const cards = document?.getElementsByClassName('notion-collection-card') - for (const e of cards) { - e.removeAttribute('href') + const cards = document.getElementsByClassName('notion-collection-card') + for (const e of cards) { + e.removeAttribute('href') + } } }, 800) diff --git a/package.json b/package.json index 99bb3f68f4..a22a16ff22 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "notion-next", - "version": "3.3.1", + "version": "3.3.2", "homepage": "https://github.com/tangly1024/NotionNext.git", "license": "MIT", "repository": {