From 86241e15254c817bc99b0b71fa0b55fbe039c168 Mon Sep 17 00:00:00 2001 From: GreyAir Date: Mon, 27 May 2024 08:25:08 +0000 Subject: [PATCH 1/3] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E9=A1=B5=E9=9D=A2?= =?UTF-8?q?=E5=8F=AF=E4=BB=A5=E9=9A=90=E8=97=8F=E8=AF=84=E8=AE=BA=E7=9A=84?= =?UTF-8?q?=E5=B1=9E=E6=80=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/Comment.js | 136 ++++++++++++++++---------------- lib/notion/getPageProperties.js | 1 + 2 files changed, 70 insertions(+), 67 deletions(-) diff --git a/components/Comment.js b/components/Comment.js index ba0d4256..bc702c4d 100644 --- a/components/Comment.js +++ b/components/Comment.js @@ -121,82 +121,84 @@ const Comment = ({ frontMatter, className }) => { return null } - return ( -
- {/* 延迟加载评论区 */} - {!shouldLoad && ( -
- Loading... - -
- )} + if (frontMatter?.comment != 'Hide') { + return ( +
+ {/* 延迟加载评论区 */} + {!shouldLoad && ( +
+ Loading... + +
+ )} - {shouldLoad && ( - - {COMMENT_ARTALK_SERVER && ( -
- -
- )} + {shouldLoad && ( + + {COMMENT_ARTALK_SERVER && ( +
+ +
+ )} - {COMMENT_TWIKOO_ENV_ID && ( -
- -
- )} + {COMMENT_TWIKOO_ENV_ID && ( +
+ +
+ )} - {COMMENT_WALINE_SERVER_URL && ( -
- -
- )} + {COMMENT_WALINE_SERVER_URL && ( +
+ +
+ )} - {COMMENT_VALINE_APP_ID && ( -
- -
- )} + {COMMENT_VALINE_APP_ID && ( +
+ +
+ )} - {COMMENT_GISCUS_REPO && ( -
- -
- )} + {COMMENT_GISCUS_REPO && ( +
+ +
+ )} - {COMMENT_CUSDIS_APP_ID && ( -
- -
- )} + {COMMENT_CUSDIS_APP_ID && ( +
+ +
+ )} - {COMMENT_UTTERRANCES_REPO && ( -
- -
- )} + {COMMENT_UTTERRANCES_REPO && ( +
+ +
+ )} - {COMMENT_GITALK_CLIENT_ID && ( -
- -
- )} + {COMMENT_GITALK_CLIENT_ID && ( +
+ +
+ )} - {COMMENT_WEBMENTION_ENABLE && ( -
- -
- )} -
- )} -
- ) + {COMMENT_WEBMENTION_ENABLE && ( +
+ +
+ )} + + )} +
+ ) + } } export default Comment diff --git a/lib/notion/getPageProperties.js b/lib/notion/getPageProperties.js index 38eede18..17f88e4e 100644 --- a/lib/notion/getPageProperties.js +++ b/lib/notion/getPageProperties.js @@ -94,6 +94,7 @@ export default async function getPageProperties( properties.type = properties.type?.[0] || '' properties.status = properties.status?.[0] || '' properties.category = properties.category?.[0] || '' + properties.comment = properties.comment?.[0] || '' // 映射值:用户个性化type和status字段的下拉框选项,在此映射回代码的英文标识 mapProperties(properties) From 34292132e794f2cfe71b419ff4063c84633fdd62 Mon Sep 17 00:00:00 2001 From: GreyAir Date: Mon, 27 May 2024 09:01:15 +0000 Subject: [PATCH 2/3] fix bug --- components/Comment.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/Comment.js b/components/Comment.js index bc702c4d..a2b73c05 100644 --- a/components/Comment.js +++ b/components/Comment.js @@ -121,7 +121,7 @@ const Comment = ({ frontMatter, className }) => { return null } - if (frontMatter?.comment != 'Hide') { + if (frontMatter?.comment !== 'Hide') { return (
Date: Fri, 31 May 2024 15:18:28 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E9=85=8D=E7=BD=AE=E6=96=87=E7=AB=A0?= =?UTF-8?q?=E9=9A=90=E8=97=8F=E8=AF=84=E8=AE=BA=E5=8C=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/Comment.js | 157 +++++++++++++++++++++--------------------- 1 file changed, 80 insertions(+), 77 deletions(-) diff --git a/components/Comment.js b/components/Comment.js index a2b73c05..fce7078d 100644 --- a/components/Comment.js +++ b/components/Comment.js @@ -121,84 +121,87 @@ const Comment = ({ frontMatter, className }) => { return null } - if (frontMatter?.comment !== 'Hide') { - return ( -
- {/* 延迟加载评论区 */} - {!shouldLoad && ( -
- Loading... - -
- )} - - {shouldLoad && ( - - {COMMENT_ARTALK_SERVER && ( -
- -
- )} - - {COMMENT_TWIKOO_ENV_ID && ( -
- -
- )} - - {COMMENT_WALINE_SERVER_URL && ( -
- -
- )} - - {COMMENT_VALINE_APP_ID && ( -
- -
- )} - - {COMMENT_GISCUS_REPO && ( -
- -
- )} - - {COMMENT_CUSDIS_APP_ID && ( -
- -
- )} - - {COMMENT_UTTERRANCES_REPO && ( -
- -
- )} - - {COMMENT_GITALK_CLIENT_ID && ( -
- -
- )} - - {COMMENT_WEBMENTION_ENABLE && ( -
- -
- )} -
- )} -
- ) + // 特定文章关闭评论区 + if (frontMatter?.comment === 'Hide') { + return null } + + return ( +
+ {/* 延迟加载评论区 */} + {!shouldLoad && ( +
+ Loading... + +
+ )} + + {shouldLoad && ( + + {COMMENT_ARTALK_SERVER && ( +
+ +
+ )} + + {COMMENT_TWIKOO_ENV_ID && ( +
+ +
+ )} + + {COMMENT_WALINE_SERVER_URL && ( +
+ +
+ )} + + {COMMENT_VALINE_APP_ID && ( +
+ +
+ )} + + {COMMENT_GISCUS_REPO && ( +
+ +
+ )} + + {COMMENT_CUSDIS_APP_ID && ( +
+ +
+ )} + + {COMMENT_UTTERRANCES_REPO && ( +
+ +
+ )} + + {COMMENT_GITALK_CLIENT_ID && ( +
+ +
+ )} + + {COMMENT_WEBMENTION_ENABLE && ( +
+ +
+ )} +
+ )} +
+ ) } export default Comment