From 45b0e2672d58f5cbe88c2088ced478219a67c584 Mon Sep 17 00:00:00 2001 From: "tangly1024.com" Date: Thu, 6 Jul 2023 15:44:33 +0800 Subject: [PATCH 1/5] log --- lib/notion/getNotionData.js | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/notion/getNotionData.js b/lib/notion/getNotionData.js index e5c50111..5a247f8c 100644 --- a/lib/notion/getNotionData.js +++ b/lib/notion/getNotionData.js @@ -36,7 +36,6 @@ export async function getGlobalData({ delete db.collectionQuery delete db.collectionId delete db.collectionView - console.log(db) return db } From dd6dc5a93ad49630acfef7d1358a8a38554793f6 Mon Sep 17 00:00:00 2001 From: tangly1024 Date: Fri, 7 Jul 2023 21:10:37 +0800 Subject: [PATCH 2/5] fix/slug-undefined-html --- blog.config.js | 2 +- lib/notion/getPageProperties.js | 12 ++++++------ pages/[...slug].js | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/blog.config.js b/blog.config.js index 9ee86fbd..da297c0c 100644 --- a/blog.config.js +++ b/blog.config.js @@ -3,7 +3,7 @@ const BLOG = { // Important page_id!!!Duplicate Template from https://www.notion.so/tanghh/02ab3b8678004aa69e9e415905ef32a5 NOTION_PAGE_ID: process.env.NOTION_PAGE_ID || '02ab3b8678004aa69e9e415905ef32a5', - PSEUDO_STATIC: false, // 伪静态路径,开启后所有文章URL都以 .html 结尾。 + PSEUDO_STATIC: process.env.NEXT_PUBLIC_PSEUDO_STATIC || false, // 伪静态路径,开启后所有文章URL都以 .html 结尾。 NEXT_REVALIDATE_SECOND: process.env.NEXT_PUBLIC_REVALIDATE_SECOND || 5, // 更新内容缓存间隔 单位(秒);即每个页面有5秒的纯静态期、此期间无论多少次访问都不会抓取notion数据;调大该值有助于节省Vercel资源、同时提升访问速率,但也会使文章更新有延迟。 THEME: process.env.NEXT_PUBLIC_THEME || 'hexo', // 主题, 支持 ['next','hexo',"fukasawa','medium','example','matery','gitbook','simple'] @see https://preview.tangly1024.com THEME_SWITCH: process.env.NEXT_PUBLIC_THEME_SWITCH || false, // 是否显示切换主题按钮 diff --git a/lib/notion/getPageProperties.js b/lib/notion/getPageProperties.js index 7c47462f..47e497ce 100644 --- a/lib/notion/getPageProperties.js +++ b/lib/notion/getPageProperties.js @@ -76,12 +76,6 @@ export default async function getPageProperties(id, block, schema, authToken, ta // 映射值:用户个性化type和status字段的下拉框选项,在此映射回代码的英文标识 mapProperties(properties) - // 开启伪静态路径 - if (BLOG.PSEUDO_STATIC) { - if (!properties?.slug?.endsWith('.html') && !properties?.slug?.startsWith('http')) { - properties.slug += '.html' - } - } properties.publishDate = new Date(properties?.date?.start_date || value.created_time).getTime() properties.publishTime = formatDate(properties.publishDate, BLOG.LANG) properties.lastEditedTime = formatDate(new Date(value?.last_edited_time), BLOG.LANG) @@ -107,6 +101,12 @@ export default async function getPageProperties(id, block, schema, authToken, ta } properties.password = properties.password ? md5(properties.slug + properties.password) : '' + // 开启伪静态路径 + if (JSON.parse(BLOG.PSEUDO_STATIC)) { + if (!properties?.slug?.endsWith('.html') && !properties?.slug?.startsWith('http')) { + properties.slug += '.html' + } + } return properties } diff --git a/pages/[...slug].js b/pages/[...slug].js index 65be2306..b106350d 100644 --- a/pages/[...slug].js +++ b/pages/[...slug].js @@ -97,7 +97,7 @@ export async function getStaticPaths() { export async function getStaticProps({ params: { slug } }) { let fullSlug = slug.join('/') - if (BLOG.PSEUDO_STATIC) { + if (JSON.parse(BLOG.PSEUDO_STATIC)) { if (!fullSlug.endsWith('.html')) { fullSlug += '.html' } From b4e6aa2dc9a5f0dde012299257b5e87f1a6baf89 Mon Sep 17 00:00:00 2001 From: tangly1024 Date: Fri, 7 Jul 2023 21:20:12 +0800 Subject: [PATCH 3/5] =?UTF-8?q?=E6=96=B0=E5=A2=9Ebilibili+youtube=20?= =?UTF-8?q?=E7=A4=BE=E4=BA=A4=E6=8C=89=E9=92=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- blog.config.js | 2 ++ themes/fukasawa/components/SocialButton.js | 6 ++++++ themes/hexo/components/SocialButton.js | 6 ++++++ themes/matery/components/SocialButton.js | 7 ++++++- themes/medium/components/SocialButton.js | 6 ++++++ themes/next/components/SocialButton.js | 6 ++++++ themes/simple/components/SocialButton.js | 6 ++++++ 7 files changed, 38 insertions(+), 1 deletion(-) diff --git a/blog.config.js b/blog.config.js index da297c0c..38e51fd0 100644 --- a/blog.config.js +++ b/blog.config.js @@ -29,6 +29,8 @@ const BLOG = { CONTACT_TELEGRAM: process.env.NEXT_PUBLIC_CONTACT_TELEGRAM || '', // 你的telegram 地址 例如 https://t.me/tangly_1024 CONTACT_LINKEDIN: process.env.NEXT_PUBLIC_CONTACT_LINKEDIN || '', // 你的linkedIn 首页 CONTACT_INSTAGRAM: process.env.NEXT_PUBLIC_CONTACT_INSTAGRAM || '', // 您的instagram地址 + CONTACT_BILIBILI: process.env.NEXT_PUBLIC_CONTACT_BILIBILI || '', // B站主页 + CONTACT_YOUTUBE: process.env.NEXT_PUBLIC_CONTACT_YOUTUBE || '', // Youtube主页 NOTION_HOST: process.env.NEXT_PUBLIC_NOTION_HOST || 'https://www.notion.so', // Notion域名,您可以选择用自己的域名进行反向代理,如果不懂得什么是反向代理,请勿修改此项 diff --git a/themes/fukasawa/components/SocialButton.js b/themes/fukasawa/components/SocialButton.js index e7039201..9bde6289 100644 --- a/themes/fukasawa/components/SocialButton.js +++ b/themes/fukasawa/components/SocialButton.js @@ -33,6 +33,12 @@ const SocialButton = () => { {BLOG.ENABLE_RSS && } + {BLOG.CONTACT_BILIBILI && + + } + {BLOG.CONTACT_YOUTUBE && + + } } diff --git a/themes/hexo/components/SocialButton.js b/themes/hexo/components/SocialButton.js index ebc28542..e3305cee 100644 --- a/themes/hexo/components/SocialButton.js +++ b/themes/hexo/components/SocialButton.js @@ -33,6 +33,12 @@ const SocialButton = () => { {BLOG.ENABLE_RSS && } + {BLOG.CONTACT_BILIBILI && + + } + {BLOG.CONTACT_YOUTUBE && + + } } diff --git a/themes/matery/components/SocialButton.js b/themes/matery/components/SocialButton.js index 71a5d9d4..6fc213a9 100644 --- a/themes/matery/components/SocialButton.js +++ b/themes/matery/components/SocialButton.js @@ -39,7 +39,12 @@ const SocialButton = () => { {BLOG.ENABLE_RSS && } - + {BLOG.CONTACT_BILIBILI && + + } + {BLOG.CONTACT_YOUTUBE && + + } } diff --git a/themes/medium/components/SocialButton.js b/themes/medium/components/SocialButton.js index 5f51033d..d33a0564 100644 --- a/themes/medium/components/SocialButton.js +++ b/themes/medium/components/SocialButton.js @@ -32,6 +32,12 @@ const SocialButton = () => { {BLOG.ENABLE_RSS && } + {BLOG.CONTACT_BILIBILI && + + } + {BLOG.CONTACT_YOUTUBE && + + } } export default SocialButton diff --git a/themes/next/components/SocialButton.js b/themes/next/components/SocialButton.js index 139bb6d0..aa537563 100644 --- a/themes/next/components/SocialButton.js +++ b/themes/next/components/SocialButton.js @@ -33,6 +33,12 @@ const SocialButton = () => { {BLOG.ENABLE_RSS && } + {BLOG.CONTACT_BILIBILI && + + } + {BLOG.CONTACT_YOUTUBE && + + } } diff --git a/themes/simple/components/SocialButton.js b/themes/simple/components/SocialButton.js index 85cbfb02..713a6de7 100644 --- a/themes/simple/components/SocialButton.js +++ b/themes/simple/components/SocialButton.js @@ -33,6 +33,12 @@ const SocialButton = () => { {BLOG.ENABLE_RSS && } + {BLOG.CONTACT_BILIBILI && + + } + {BLOG.CONTACT_YOUTUBE && + + } } From 91bdba26feb5bb2c46aeef2591835094bb5acc1d Mon Sep 17 00:00:00 2001 From: tangly1024 Date: Fri, 7 Jul 2023 21:31:36 +0800 Subject: [PATCH 4/5] fix/mac_code_style --- blog.config.js | 2 +- components/PrismMac.js | 2 +- styles/notion.css | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/blog.config.js b/blog.config.js index 38e51fd0..6c872906 100644 --- a/blog.config.js +++ b/blog.config.js @@ -97,7 +97,7 @@ const BLOG = { PRISM_JS_PATH: 'https://npm.elemecdn.com/prismjs@1.29.0/components/', PRISM_THEME_PATH: 'https://npm.elemecdn.com/prism-themes/themes/prism-a11y-dark.min.css', // 代码样式主题 更多参考 https://github.com/PrismJS/prism-themes - CODE_MAC_BAR: true, // 代码左上角显示mac的红黄绿图标 + CODE_MAC_BAR: process.env.NEXT_PUBLIC_CODE_MAC_BAR || true, // 代码左上角显示mac的红黄绿图标 CODE_LINE_NUMBERS: process.env.NEXT_PUBLIC_CODE_LINE_NUMBERS || 'false', // 是否显示行号 // Mermaid 图表CDN diff --git a/components/PrismMac.js b/components/PrismMac.js index 1d2cddc3..01f4e65b 100644 --- a/components/PrismMac.js +++ b/components/PrismMac.js @@ -21,7 +21,7 @@ import { useRouter } from 'next/navigation' const PrismMac = () => { const router = useRouter() useEffect(() => { - if (BLOG.CODE_MAC_BAR) { + if (JSON.parse(BLOG.CODE_MAC_BAR)) { loadExternalResource('/css/prism-mac-style.css', 'css') } loadExternalResource(BLOG.PRISM_THEME_PATH, 'css') diff --git a/styles/notion.css b/styles/notion.css index b9e10f4c..b943aff9 100644 --- a/styles/notion.css +++ b/styles/notion.css @@ -768,7 +768,7 @@ code[class*='language-'] { overflow: auto; font-family: SFMono-Regular, Consolas, 'Liberation Mono', Menlo, Courier, monospace; - @apply w-full mb-4 dark:bg-black; + @apply w-full mb-0 dark:bg-black !important; } .notion-column { @@ -2016,7 +2016,7 @@ code.language-mermaid { } .code-toolbar{ - @apply w-full shadow-md; + @apply w-full shadow-md pb-0; } .mermaid > svg { From ba839487837ef63246d9c4d21a71057272873302 Mon Sep 17 00:00:00 2001 From: tangly1024 Date: Fri, 7 Jul 2023 21:34:00 +0800 Subject: [PATCH 5/5] 3.16.4 --- .env.local | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.env.local b/.env.local index fcca03b1..fc777115 100644 --- a/.env.local +++ b/.env.local @@ -1,2 +1,2 @@ # 环境变量 @see https://www.nextjs.cn/docs/basic-features/environment-variables -NEXT_PUBLIC_VERSION=3.16.3 \ No newline at end of file +NEXT_PUBLIC_VERSION=3.16.4 \ No newline at end of file diff --git a/package.json b/package.json index b99f9e55..82c9f396 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "notion-next", - "version": "3.16.3", + "version": "3.16.4", "homepage": "https://github.com/tangly1024/NotionNext.git", "license": "MIT", "repository": {