hexo 主题支持全屏文章,隐藏侧边组件

This commit is contained in:
tangly1024
2023-12-30 17:19:21 +08:00
parent b970182403
commit b15d5f7c2c
4 changed files with 16 additions and 4 deletions

View File

@@ -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

View File

@@ -12,6 +12,12 @@ export default function PostHeader({ post, siteInfo }) {
if (!post) {
return <></>
}
// 文章全屏隐藏标头
if (post.fullWidth) {
return <div className='my-8'/>
}
const headerImage = post?.pageCover ? post.pageCover : siteInfo?.pageCover
return (

View File

@@ -38,6 +38,12 @@ export default function SideRight(props) {
} = props
const { locale } = useGlobal()
// 文章全屏处理
if (post && post?.fullWidth) {
return null
}
return (
<div id='sideRight' className={'space-y-4 lg:w-80 lg:pt-0 px-2 pt-4'}>
<InfoCard {...props} />

View File

@@ -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 (
<div id='theme-hexo'>
@@ -70,7 +71,7 @@ const LayoutBase = props => {
{/* 主区块 */}
<main id="wrapper" className={`${siteConfig('HEXO_HOME_BANNER_ENABLE', null, CONFIG) ? '' : 'pt-16'} bg-hexo-background-gray dark:bg-black w-full py-8 md:px-8 lg:px-24 min-h-screen relative`}>
<div id="container-inner" className={(JSON.parse(siteConfig('LAYOUT_SIDEBAR_REVERSE')) ? 'flex-row-reverse' : '') + ' w-full mx-auto lg:flex lg:space-x-4 justify-center relative z-10'} >
<div className={`${className || ''} w-full max-w-4xl h-full overflow-hidden`}>
<div className={`${className || ''} w-full ${fullWidth ? '' : 'max-w-4xl'} h-full overflow-hidden`}>
<Transition
show={!onLoading}