From 8fd2f70d7b27a9861476dc1c92f2ec88438a34de Mon Sep 17 00:00:00 2001 From: anime Date: Sun, 6 Jul 2025 03:22:23 +0800 Subject: [PATCH] feat(NotByAI): make NotByAI component configurable via site config - Add conditional rendering for NotByAI component in all themes - Default all new config options to false Closes #3351 --- themes/commerce/components/ArticleCopyright.js | 8 +++++--- themes/heo/components/PostCopyright.js | 8 +++++--- themes/heo/config.js | 1 + themes/hexo/components/ArticleCopyright.js | 8 +++++--- themes/hexo/config.js | 1 + themes/matery/components/ArticleCopyright.js | 8 +++++--- themes/matery/config.js | 8 +++++++- themes/next/components/ArticleCopyright.js | 8 +++++--- themes/next/config.js | 1 + 9 files changed, 35 insertions(+), 16 deletions(-) diff --git a/themes/commerce/components/ArticleCopyright.js b/themes/commerce/components/ArticleCopyright.js index 0d95536a..2c559a5b 100644 --- a/themes/commerce/components/ArticleCopyright.js +++ b/themes/commerce/components/ArticleCopyright.js @@ -40,9 +40,11 @@ export default function ArticleCopyright() { {locale.COMMON.COPYRIGHT}: {locale.COMMON.COPYRIGHT_NOTICE} -
  • - -
  • + {siteConfig('ARTICLE_NOT_BY_AI', false, CONFIG) && ( +
  • + +
  • + )} ) diff --git a/themes/heo/components/PostCopyright.js b/themes/heo/components/PostCopyright.js index 6faf9201..4fb1eb25 100644 --- a/themes/heo/components/PostCopyright.js +++ b/themes/heo/components/PostCopyright.js @@ -44,9 +44,11 @@ export default function PostCopyright() { {locale.COMMON.COPYRIGHT}: {locale.COMMON.COPYRIGHT_NOTICE} -
  • - -
  • + {siteConfig('HEO_ARTICLE_NOT_BY_AI', false, CONFIG) && ( +
  • + +
  • + )} ) diff --git a/themes/heo/config.js b/themes/heo/config.js index 4a037982..b093f61f 100644 --- a/themes/heo/config.js +++ b/themes/heo/config.js @@ -146,6 +146,7 @@ const CONFIG = { HEO_ARTICLE_ADJACENT: true, // 显示上一篇下一篇文章推荐 HEO_ARTICLE_COPYRIGHT: true, // 显示文章版权声明 + HEO_ARTICLE_NOT_BY_AI: false, // 显示非AI写作 HEO_ARTICLE_RECOMMEND: true, // 文章关联推荐 HEO_WIDGET_LATEST_POSTS: true, // 显示最新文章卡 diff --git a/themes/hexo/components/ArticleCopyright.js b/themes/hexo/components/ArticleCopyright.js index 63aa69c6..a7be768d 100644 --- a/themes/hexo/components/ArticleCopyright.js +++ b/themes/hexo/components/ArticleCopyright.js @@ -40,9 +40,11 @@ export default function ArticleCopyright() { {locale.COMMON.COPYRIGHT}: {locale.COMMON.COPYRIGHT_NOTICE} -
  • - -
  • + {siteConfig('HEXO_ARTICLE_NOT_BY_AI', false, CONFIG) && ( +
  • + +
  • + )} ) diff --git a/themes/hexo/config.js b/themes/hexo/config.js index c4b0be31..a6fc222a 100644 --- a/themes/hexo/config.js +++ b/themes/hexo/config.js @@ -32,6 +32,7 @@ const CONFIG = { HEXO_ARTICLE_ADJACENT: true, // 显示上一篇下一篇文章推荐 HEXO_ARTICLE_COPYRIGHT: true, // 显示文章版权声明 + HEXO_ARTICLE_NOT_BY_AI: false, // 显示非AI写作 HEXO_ARTICLE_RECOMMEND: true, // 文章关联推荐 HEXO_WIDGET_LATEST_POSTS: true, // 显示最新文章卡 diff --git a/themes/matery/components/ArticleCopyright.js b/themes/matery/components/ArticleCopyright.js index 31817c68..64fe19e5 100644 --- a/themes/matery/components/ArticleCopyright.js +++ b/themes/matery/components/ArticleCopyright.js @@ -38,9 +38,11 @@ export default function ArticleCopyright() { {locale.COMMON.COPYRIGHT}: {locale.COMMON.COPYRIGHT_NOTICE} -
  • - -
  • + {siteConfig('MATERY_ARTICLE_NOT_BY_AI', false, CONFIG) && ( +
  • + +
  • + )} ) diff --git a/themes/matery/config.js b/themes/matery/config.js index 705d3765..5835051c 100644 --- a/themes/matery/config.js +++ b/themes/matery/config.js @@ -1,7 +1,12 @@ const CONFIG = { MATERY_HOME_BANNER_ENABLE: true, // 3.14.1以后的版本中,欢迎语在blog.config.js中配置,用英文逗号','隔开多个。 - MATERY_HOME_BANNER_GREETINGS: ['Hi,我是一个程序员', 'Hi,我是一个打工人', 'Hi,我是一个干饭人', '欢迎来到我的博客🎉'], // 首页大图标语文字 + MATERY_HOME_BANNER_GREETINGS: [ + 'Hi,我是一个程序员', + 'Hi,我是一个打工人', + 'Hi,我是一个干饭人', + '欢迎来到我的博客🎉' + ], // 首页大图标语文字 MATERY_HOME_NAV_BUTTONS: true, // 首页是否显示分类大图标按钮 MATERY_HOME_NAV_BACKGROUND_IMG_FIXED: false, // 首页背景图滚动时是否固定,true 则滚动时图片不懂; false则随鼠标滚动 @@ -21,6 +26,7 @@ const CONFIG = { MATERY_ARTICLE_ADJACENT: true, // 显示上一篇下一篇文章推荐 MATERY_ARTICLE_COPYRIGHT: true, // 显示文章版权声明 + MATERY_ARTICLE_NOT_BY_AI: false, // 显示非AI写作 MATERY_ARTICLE_RECOMMEND: true, // 文章关联推荐 MATERY_WIDGET_LATEST_POSTS: true, // 显示最新文章卡 diff --git a/themes/next/components/ArticleCopyright.js b/themes/next/components/ArticleCopyright.js index dfd70332..6626713c 100644 --- a/themes/next/components/ArticleCopyright.js +++ b/themes/next/components/ArticleCopyright.js @@ -28,9 +28,11 @@ export default function ArticleCopyright({ author, url }) { {locale.COMMON.COPYRIGHT}: {locale.COMMON.COPYRIGHT_NOTICE} -
  • - -
  • + {siteConfig('NEXT_ARTICLE_NOT_BY_AI', false, CONFIG) && ( +
  • + +
  • + )} ) diff --git a/themes/next/config.js b/themes/next/config.js index f6f20559..330dedd2 100644 --- a/themes/next/config.js +++ b/themes/next/config.js @@ -38,6 +38,7 @@ const CONFIG = { NEXT_ARTICLE_RELATE_POSTS: true, // 相关文章推荐 NEXT_ARTICLE_COPYRIGHT: true, // 文章版权声明 + NEXT_ARTICLE_NOT_BY_AI: false, // 显示非AI写作 NEXT_ARTICLE_INFO: true // 显示文章信息 }