From 418dc38de6c1e4ef93a461d39cdc1a651c9ca8df Mon Sep 17 00:00:00 2001 From: tangly1024 Date: Thu, 31 Mar 2022 11:30:19 +0800 Subject: [PATCH] =?UTF-8?q?Hexo:=20=E8=83=8C=E6=99=AF=E5=9B=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- themes/hexo/components/ArticleRecommend.js | 4 ++-- themes/hexo/components/HeaderArticle.js | 5 ++--- themes/hexo/components/LatestPostsGroup.js | 4 ++-- themes/hexo/components/SideRight.js | 2 +- 4 files changed, 7 insertions(+), 8 deletions(-) diff --git a/themes/hexo/components/ArticleRecommend.js b/themes/hexo/components/ArticleRecommend.js index 0640a38e..8719be05 100644 --- a/themes/hexo/components/ArticleRecommend.js +++ b/themes/hexo/components/ArticleRecommend.js @@ -8,7 +8,7 @@ import { useGlobal } from '@/lib/global' * @param {prev,next} param0 * @returns */ -export default function ArticleRecommend ({ recommendPosts }) { +export default function ArticleRecommend ({ recommendPosts, siteInfo }) { if (!CONFIG_HEXO.ARTICLE_RECOMMEND || !recommendPosts || recommendPosts.length === 0) { return <> } @@ -25,7 +25,7 @@ export default function ArticleRecommend ({ recommendPosts }) { {recommendPosts.map(post => { const headerImage = post?.page_cover ? `url("${post.page_cover}")` - : `url("/${BLOG.HOME_BANNER_IMAGE}")` + : `url("${siteInfo?.pageCover}")` return ( diff --git a/themes/hexo/components/HeaderArticle.js b/themes/hexo/components/HeaderArticle.js index 36530fd6..3a470394 100644 --- a/themes/hexo/components/HeaderArticle.js +++ b/themes/hexo/components/HeaderArticle.js @@ -2,10 +2,9 @@ import Link from 'next/link' import { useGlobal } from '@/lib/global' import formatDate from '@/lib/formatDate' import { useEffect } from 'react' -import BLOG from '@/blog.config' -export default function HeaderArticle ({ post }) { - const headerImage = post?.page_cover ? `url("${post.page_cover}")` : `url("/${BLOG.HOME_BANNER_IMAGE}")` +export default function HeaderArticle ({ post, siteInfo }) { + const headerImage = post?.page_cover ? `url("${post.page_cover}")` : `url("${siteInfo?.pageCover}")` const { isDarkMode } = useGlobal() const { locale } = useGlobal() diff --git a/themes/hexo/components/LatestPostsGroup.js b/themes/hexo/components/LatestPostsGroup.js index dc4a993d..d3a4c51d 100644 --- a/themes/hexo/components/LatestPostsGroup.js +++ b/themes/hexo/components/LatestPostsGroup.js @@ -9,7 +9,7 @@ import { useRouter } from 'next/router' * @param sliceCount 截取展示的数量 默认6 * @constructor */ -const LatestPostsGroup = ({ posts }) => { +const LatestPostsGroup = ({ posts, siteInfo }) => { if (!posts) { return <> } @@ -29,7 +29,7 @@ const LatestPostsGroup = ({ posts }) => { const selected = currentPath === `${BLOG.PATH}/article/${post.slug}` const headerImage = post?.page_cover ? `url("${post.page_cover}")` - : `url("/${BLOG.HOME_BANNER_IMAGE}")` + : `url("${siteInfo?.pageCover}")` return ( )} {CONFIG_HEXO.WIDGET_LATEST_POSTS && latestPosts && latestPosts.length > 0 && - + }