diff --git a/themes/hexo/LayoutBase.js b/themes/hexo/LayoutBase.js index 3f0872ea..0c4b7600 100644 --- a/themes/hexo/LayoutBase.js +++ b/themes/hexo/LayoutBase.js @@ -51,10 +51,10 @@ const LayoutBase = (props) => { {headerSlot} -
+
-
-
+
+
{onLoading ? : children}
diff --git a/themes/hexo/components/ArticleAdjacent.js b/themes/hexo/components/ArticleAdjacent.js index b7e36420..3ce2d17d 100644 --- a/themes/hexo/components/ArticleAdjacent.js +++ b/themes/hexo/components/ArticleAdjacent.js @@ -10,15 +10,15 @@ export default function ArticleAdjacent ({ prev, next }) { if (!prev || !next || !CONFIG_HEXO.ARTICLE_ADJACENT) { return <> } - return
+ return
- - {prev.title} + + {prev.title} - {next.title} - + {next.title} +
diff --git a/themes/hexo/components/ArticleCopyright.js b/themes/hexo/components/ArticleCopyright.js index 42a27552..aadf73b9 100644 --- a/themes/hexo/components/ArticleCopyright.js +++ b/themes/hexo/components/ArticleCopyright.js @@ -16,7 +16,7 @@ export default function ArticleCopyright () { }) const { locale } = useGlobal() - return
+ return
  • {locale.COMMON.AUTHOR}: diff --git a/themes/hexo/components/ArticleDetail.js b/themes/hexo/components/ArticleDetail.js index f0fa966b..38c7e073 100644 --- a/themes/hexo/components/ArticleDetail.js +++ b/themes/hexo/components/ArticleDetail.js @@ -10,6 +10,7 @@ import { useEffect, useRef } from 'react' import { Code, Collection, CollectionRow, Equation, NotionRenderer } from 'react-notion-x' import ArticleAdjacent from './ArticleAdjacent' import ArticleCopyright from './ArticleCopyright' +import ArticleRecommend from './ArticleRecommend' /** * @@ -67,6 +68,7 @@ export default function ArticleDetail (props) {
+ diff --git a/themes/hexo/components/ArticleRecommend.js b/themes/hexo/components/ArticleRecommend.js new file mode 100644 index 00000000..a0503694 --- /dev/null +++ b/themes/hexo/components/ArticleRecommend.js @@ -0,0 +1,52 @@ +import Link from 'next/link' +import CONFIG_HEXO from '../config_hexo' +import BLOG from '@/blog.config' +import { useGlobal } from '@/lib/global' + +/** + * 关联推荐文章 + * @param {prev,next} param0 + * @returns + */ +export default function ArticleRecommend ({ recommendPosts }) { + if (!recommendPosts || !CONFIG_HEXO.ARTICLE_RECOMMEND) { + return <> + } + const { locale } = useGlobal() + return ( +
+
+
+ + {locale.COMMON.RELATE_POSTS} +
+
+
+ {recommendPosts.map(post => { + const headerImage = post?.page_cover + ? `url("${post.page_cover}")` + : `url("/${CONFIG_HEXO.HOME_BANNER_IMAGE}")` + + return ( + + + +
+
+
+
{post.date?.start_date}
+
{post.title}
+
+
+
+
+ + ) + })} +
+
+ ) +} diff --git a/themes/hexo/components/LatestPostsGroup.js b/themes/hexo/components/LatestPostsGroup.js index 5829570c..5b0425ef 100644 --- a/themes/hexo/components/LatestPostsGroup.js +++ b/themes/hexo/components/LatestPostsGroup.js @@ -2,6 +2,7 @@ import BLOG from '@/blog.config' import { useGlobal } from '@/lib/global' import Link from 'next/link' import { useRouter } from 'next/router' +import CONFIG_HEXO from '../config_hexo' /** * 最新文章列表 @@ -19,16 +20,24 @@ const LatestPostsGroup = ({ posts }) => { return <>
-
{locale.COMMON.LATEST_POSTS}
+
{locale.COMMON.LATEST_POSTS}
{posts.map(post => { const selected = currentPath === `${BLOG.PATH}/article/${post.slug}` + const headerImage = post?.page_cover + ? `url("${post.page_cover}")` + : `url("/${CONFIG_HEXO.HOME_BANNER_IMAGE}")` + return ( -
-
{post.title}
+
+
+
+
{post.title}
+
{post.date?.start_date}
+
diff --git a/themes/hexo/components/SideRight.js b/themes/hexo/components/SideRight.js index ddddb89d..5114c1aa 100644 --- a/themes/hexo/components/SideRight.js +++ b/themes/hexo/components/SideRight.js @@ -5,7 +5,7 @@ import TagGroups from './TagGroups' import Catalog from './Catalog' import { InfoCard } from './InfoCard' import { AnalyticsCard } from './AnalyticsCard' - +import CONFIG_HEXO from '../config_hexo' export default function SideRight (props) { const { post, currentCategory, categories, latestPosts, tags, @@ -13,9 +13,9 @@ export default function SideRight (props) { } = props return ( -
+
- + { CONFIG_HEXO.WIDGET_ANALYTICS && } {showCategory && ( @@ -33,7 +33,7 @@ export default function SideRight (props) { )} - {latestPosts && + {CONFIG_HEXO.WIDGET_LATEST_POSTS && latestPosts && } diff --git a/themes/hexo/config_hexo.js b/themes/hexo/config_hexo.js index 8b5b6723..819f181b 100644 --- a/themes/hexo/config_hexo.js +++ b/themes/hexo/config_hexo.js @@ -16,7 +16,10 @@ const CONFIG_HEXO = { ARTICLE_ADJACENT: true, // 显示上一篇下一篇文章推荐 ARTICLE_COPYRIGHT: true, // 显示文章版权声明 + ARTICLE_RECOMMEND: true, // 文章关联推荐 + WIDGET_LATEST_POSTS: true, // 显示最新文章卡 + WIDGET_ANALYTICS: false, // 显示统计卡 WIDGET_TO_TOP: true, WIDGET_TO_COMMENT: true, // 跳到评论区 WIDGET_DARK_MODE: true, // 夜间模式