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/blog.config.js b/blog.config.js index e5d56764..42a75887 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, // 是否显示切换主题按钮 @@ -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域名,您可以选择用自己的域名进行反向代理,如果不懂得什么是反向代理,请勿修改此项 @@ -95,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/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/package.json b/package.json index b98f0b05..ad0d5e78 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": { diff --git a/pages/[...slug].js b/pages/[...slug].js index 2a0be8f4..d6900b73 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' } diff --git a/styles/notion.css b/styles/notion.css index 0062e13c..65345f6d 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 { 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 && + + } }