From c1164d9cb8b6fa5751122c76da6b208a20ab7928 Mon Sep 17 00:00:00 2001 From: "tangly1024.com" Date: Wed, 28 Aug 2024 12:52:22 +0800 Subject: [PATCH] =?UTF-8?q?Hexo=E4=B8=BB=E9=A2=98=E5=8F=B3=E4=BE=A7?= =?UTF-8?q?=E5=9B=BA=E5=AE=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- themes/hexo/components/SideRight.js | 105 ++++++++++++++++------------ themes/hexo/index.js | 5 +- 2 files changed, 63 insertions(+), 47 deletions(-) diff --git a/themes/hexo/components/SideRight.js b/themes/hexo/components/SideRight.js index 73d26593..bad000c1 100644 --- a/themes/hexo/components/SideRight.js +++ b/themes/hexo/components/SideRight.js @@ -1,16 +1,16 @@ -import Card from './Card' -import CategoryGroup from './CategoryGroup' -import LatestPostsGroup from './LatestPostsGroup' -import TagGroups from './TagGroups' -import Catalog from './Catalog' -import { InfoCard } from './InfoCard' -import { AnalyticsCard } from './AnalyticsCard' -import CONFIG from '../config' -import dynamic from 'next/dynamic' -import Announcement from './Announcement' -import { useGlobal } from '@/lib/global' import Live2D from '@/components/Live2D' import { siteConfig } from '@/lib/config' +import { useGlobal } from '@/lib/global' +import dynamic from 'next/dynamic' +import CONFIG from '../config' +import { AnalyticsCard } from './AnalyticsCard' +import Announcement from './Announcement' +import Card from './Card' +import Catalog from './Catalog' +import CategoryGroup from './CategoryGroup' +import { InfoCard } from './InfoCard' +import LatestPostsGroup from './LatestPostsGroup' +import TagGroups from './TagGroups' const HexoRecentComments = dynamic(() => import('./HexoRecentComments')) const FaceBookPage = dynamic( @@ -33,8 +33,17 @@ const FaceBookPage = dynamic( */ export default function SideRight(props) { const { - post, currentCategory, categories, latestPosts, tags, - currentTag, showCategory, showTag, rightAreaSlot, notice, className + post, + currentCategory, + categories, + latestPosts, + tags, + currentTag, + showCategory, + showTag, + rightAreaSlot, + notice, + className } = props const { locale } = useGlobal() @@ -45,44 +54,54 @@ export default function SideRight(props) { } return ( -
- - {siteConfig('HEXO_WIDGET_ANALYTICS', null, CONFIG) && } +
+
+ {post && post.toc && post.toc.length > 1 && ( + + + + )} - {showCategory && ( - -
- {locale.COMMON.CATEGORY} -
- -
- )} - {showTag && ( - - - - )} - {siteConfig('HEXO_WIDGET_LATEST_POSTS', null, CONFIG) && latestPosts && latestPosts.length > 0 && - - } + + {siteConfig('HEXO_WIDGET_ANALYTICS', null, CONFIG) && ( + + )} - + {showCategory && ( + +
+ {locale.COMMON.CATEGORY} +
+ +
+ )} + {showTag && ( + + + + )} + {siteConfig('HEXO_WIDGET_LATEST_POSTS', null, CONFIG) && + latestPosts && + latestPosts.length > 0 && ( + + + + )} - {siteConfig('COMMENT_WALINE_SERVER_URL') && siteConfig('COMMENT_WALINE_RECENT') && } + -
- {post && post.toc && post.toc.length > 1 && - - } + {siteConfig('COMMENT_WALINE_SERVER_URL') && + siteConfig('COMMENT_WALINE_RECENT') && } {rightAreaSlot} - +
-
) } diff --git a/themes/hexo/index.js b/themes/hexo/index.js index 4988dad9..d478dbc3 100644 --- a/themes/hexo/index.js +++ b/themes/hexo/index.js @@ -141,10 +141,7 @@ const LayoutBase = props => {
{/* 右侧栏 */} - +