From 7e7f0b83a088ccaf40b5be657a8338832b06a209 Mon Sep 17 00:00:00 2001 From: "tangly1024.com" Date: Fri, 12 Apr 2024 15:42:51 +0800 Subject: [PATCH 1/3] build fix --- next.config.js | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/next.config.js b/next.config.js index cf4fa85f..f4352e6e 100644 --- a/next.config.js +++ b/next.config.js @@ -53,7 +53,7 @@ function scanSubdirectories(directory) { return subdirectories } -module.exports = withBundleAnalyzer({ +const nextConfig = { images: { // 图片压缩 formats: ['image/avif', 'image/webp'], @@ -79,12 +79,15 @@ module.exports = withBundleAnalyzer({ } ] }, - // 多语言 - i18n: { - defaultLocale: BLOG.LANG.slice(0, 2), - // 支持的所有多语言,按需填写即可 - locales - }, + // 多语言, 在export时禁用 + i18n: + process.env.npm_lifecycle_event === 'export' + ? undefined + : { + defaultLocale: BLOG.LANG.slice(0, 2), + // 支持的所有多语言,按需填写即可 + locales + }, // 重写url async rewrites() { // 处理多语言重定向 @@ -180,4 +183,6 @@ module.exports = withBundleAnalyzer({ NODE_ENV_API: process.env.NODE_ENV_API || 'prod', THEMES: themes } -}) +} + +module.exports = withBundleAnalyzer(nextConfig) From 85fa2466fccaebac2ef792daafbc6e08b551dfdb Mon Sep 17 00:00:00 2001 From: "tangly1024.com" Date: Fri, 12 Apr 2024 16:14:09 +0800 Subject: [PATCH 2/3] fix notion page max-width --- styles/notion.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/styles/notion.css b/styles/notion.css index e231c45f..a94f5fab 100644 --- a/styles/notion.css +++ b/styles/notion.css @@ -521,7 +521,7 @@ summary > .notion-h { } .notion-page { - width: var(--notion-max-width); + /* width: var(--notion-max-width); */ padding-left: calc(min(12px, 8vw)); padding-right: calc(min(12px, 8vw)); } From cf68df243523c6af5058cdb882e64033b0b770e8 Mon Sep 17 00:00:00 2001 From: "tangly1024.com" Date: Fri, 12 Apr 2024 16:14:25 +0800 Subject: [PATCH 3/3] fix lost of siteInfo and bg-cover --- lib/db/getSiteData.js | 5 +++-- styles/notion.css | 1 + 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/db/getSiteData.js b/lib/db/getSiteData.js index ff31458c..ef2f2389 100755 --- a/lib/db/getSiteData.js +++ b/lib/db/getSiteData.js @@ -251,7 +251,7 @@ function getCategoryOptions(schema) { * @returns {Promise<{title,description,pageCover,icon}>} */ function getSiteInfo({ collection, block, NOTION_CONFIG, pageId }) { - if (!collection || !block || NOTION_CONFIG || pageId) { + if (!collection && !block) { return { title: BLOG.TITLE, description: BLOG.DESCRIPTION, @@ -267,8 +267,9 @@ function getSiteInfo({ collection, block, NOTION_CONFIG, pageId }) { : BLOG.DESCRIPTION const pageCover = collection?.cover - ? mapImgUrl(collection?.cover, block[pageId]?.value) + ? mapImgUrl(collection?.cover, collection, 'collection') : BLOG.HOME_BANNER_IMAGE + // 用户头像压缩一下 let icon = compressImage( collection?.icon diff --git a/styles/notion.css b/styles/notion.css index a94f5fab..0843443f 100644 --- a/styles/notion.css +++ b/styles/notion.css @@ -522,6 +522,7 @@ summary > .notion-h { .notion-page { /* width: var(--notion-max-width); */ + width: 100% !important; padding-left: calc(min(12px, 8vw)); padding-right: calc(min(12px, 8vw)); }