From b15d5f7c2ccf0ffe48448b3d1cd0a70927f5c85c Mon Sep 17 00:00:00 2001 From: tangly1024 Date: Sat, 30 Dec 2023 17:19:21 +0800 Subject: [PATCH] =?UTF-8?q?hexo=20=E4=B8=BB=E9=A2=98=E6=94=AF=E6=8C=81?= =?UTF-8?q?=E5=85=A8=E5=B1=8F=E6=96=87=E7=AB=A0=EF=BC=8C=E9=9A=90=E8=97=8F?= =?UTF-8?q?=E4=BE=A7=E8=BE=B9=E7=BB=84=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/notion/getNotion.js | 3 +-- themes/hexo/components/PostHeader.js | 6 ++++++ themes/hexo/components/SideRight.js | 6 ++++++ themes/hexo/index.js | 5 +++-- 4 files changed, 16 insertions(+), 4 deletions(-) diff --git a/lib/notion/getNotion.js b/lib/notion/getNotion.js index 3da84ee8..aad65379 100644 --- a/lib/notion/getNotion.js +++ b/lib/notion/getNotion.js @@ -16,7 +16,6 @@ export async function getNotion(pageId) { } const postInfo = blockMap?.block?.[idToUuid(pageId)].value - return { id: pageId, type: postInfo, @@ -26,7 +25,7 @@ export async function getNotion(pageId) { status: 'Published', createdTime: formatDate(new Date(postInfo.created_time).toString(), BLOG.LANG), lastEditedDay: formatDate(new Date(postInfo?.last_edited_time).toString(), BLOG.LANG), - fullWidth: false, + fullWidth: postInfo?.fullWidth, page_cover: getPageCover(postInfo), date: { start_date: formatDate(new Date(postInfo?.last_edited_time).toString(), BLOG.LANG) }, blockMap diff --git a/themes/hexo/components/PostHeader.js b/themes/hexo/components/PostHeader.js index 8a69b9ef..fb051e8f 100644 --- a/themes/hexo/components/PostHeader.js +++ b/themes/hexo/components/PostHeader.js @@ -12,6 +12,12 @@ export default function PostHeader({ post, siteInfo }) { if (!post) { return <> } + + // 文章全屏隐藏标头 + if (post.fullWidth) { + return
+ } + const headerImage = post?.pageCover ? post.pageCover : siteInfo?.pageCover return ( diff --git a/themes/hexo/components/SideRight.js b/themes/hexo/components/SideRight.js index c5600eb4..497a7b2f 100644 --- a/themes/hexo/components/SideRight.js +++ b/themes/hexo/components/SideRight.js @@ -38,6 +38,12 @@ export default function SideRight(props) { } = props const { locale } = useGlobal() + + // 文章全屏处理 + if (post && post?.fullWidth) { + return null + } + return (
diff --git a/themes/hexo/index.js b/themes/hexo/index.js index 7e770dc5..4f8dbe92 100644 --- a/themes/hexo/index.js +++ b/themes/hexo/index.js @@ -40,8 +40,9 @@ import { siteConfig } from '@/lib/config' * @constructor */ const LayoutBase = props => { - const { children, headerSlot, floatSlot, slotTop, meta, className } = props + const { post, children, headerSlot, floatSlot, slotTop, meta, className } = props const { onLoading } = useGlobal() + const fullWidth = post?.fullWidth ?? false return (
@@ -70,7 +71,7 @@ const LayoutBase = props => { {/* 主区块 */}
-
+